[Skip to main content](#vessel-content)

#   Discount when at least X differents products are purchased

##

- **[marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")**
- [![marcmarc's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1529-marcmarc "View marcmarc's Profile") Topic Author
- [ Offline](/forum/user/1529-marcmarc)

Less More

- Posts: 74
- Thank you received: 7
-
-

1 year 6 months ago [\#366812](#366812) by [marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")  *[Discount when at least X differents products are purchased](/forum/46-discount-coupon/909356-discount-when-at-least-x-differents-products-are-purchased#366812 "-- HikaShop version -- : 5.1.5 -- Joomla version -- : 8.2.6 -- PHP version -- : 8.2.26  Hi, I would like to implement an automatic % discount when at least 3 different products are purchased. I mean: 5 product A = no discount 5 product A + 2 product B = no discount 1 product A + 1 product B + 1 product C = -10%  How to achieve that?  Regards Marc")* was created by *[marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")*

-- HikaShop version -- : 5.1.5
-- Joomla version -- : 8.2.6
-- PHP version -- : 8.2.26

Hi,
I would like to implement an automatic % discount when at least 3 different products are purchased.
I mean:
5 product A = no discount
5 product A + 2 product B = no discount
1 product A + 1 product B + 1 product C = -10%

How to achieve that?

Regards
Marc

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDkzNTYtZGlzY291bnQtd2hlbi1hdC1sZWFzdC14LWRpZmZlcmVudHMtcHJvZHVjdHMtYXJlLXB1cmNoYXNlZD90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86323
- Thank you received: 14283
-
-

1 year 6 months ago [\#366815](#366815) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount when at least X differents products are purchased](/forum/46-discount-coupon/909356-discount-when-at-least-x-differents-products-are-purchased#366815 "-- HikaShop version -- : 5.1.5 -- Joomla version -- : 8.2.6 -- PHP version -- : 8.2.26  Hi, I would like to implement an automatic % discount when at least 3 different products are purchased. I mean: 5 product A = no discount 5 product A + 2 product B = no discount 1 product A + 1 product B + 1 product C = -10%  How to achieve that?  Regards Marc")*

Hi,

HikaShop's coupon / discount system has a "minimum quantity ordered" and a "maximum quantity ordered" setting so that a discount can apply once a certain number of products in the cart is reached.
However, that system doesn't distinguish between products. So if you set a minimum of 3, it will match regardless of whether it is 3 items of product A, or 1 of product A + 1 of product B + 1 of product C.

I see 2 potential solutions:
1. You could develop a small plugin implementing the onAfterCouponCheck event of HikaShop:
[ www.hikashop.com/support/documentation/6...l#onAfterCouponCheck](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#onAfterCouponCheck)
This way, you could configure a coupon without a restriction on the number of products, and process that restriction in the code of your plugin. While this allows for maximum customization capability, it requires development skills or hiring someone who could do it for you.

2. The cart fee plugin is a plugin which can be used to add extra fees to carts:
[ www.hikashop.com/marketplace/product/279-cart-fee.html](https://www.hikashop.com/marketplace/product/279-cart-fee.html)
And if the result of the calculation made by the plugin is a negative amount, it will effectively be a discount.
So, you could:
- create a custom product field via the menu Display&gt;Custom fields:
[ www.hikashop.com/support/documentation/4...shop-field-form.html](https://www.hikashop.com/support/documentation/42-hikashop-field-form.html)
- in each product, you would fill that custom field with the value "1". You can automate this with a mass action:
[ www.hikashop.com/support/documentation/167-massaction-form.html](https://www.hikashop.com/support/documentation/167-massaction-form.html)
- then, in your cart fees plugin settings page, you could add an entry with the condition: Code:

{product.xxx}&gt;=3

where xxx is the column name of the custom field
and a formula: Code:

{price}*-0.1

The system will first sum the value of product.xxx for each entry of the cart, and since you don't multiply by the tag {product.cart_product_quantity} in your condition, it won't take into account the quantity of each entry in the cart. And thus, the condition will only match if there are at least 3 distinct products in the cart, regardless of the quantity of each one.
Then, for the fee calculation, it will replace {price} by the total amount of the cart and multiply by -0.1 which will effectively add a fee of -10% to the cart.
It's a bit convoluted to setup, but it doesn't require any coding and should do exactly what you want.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDkzNTYtZGlzY291bnQtd2hlbi1hdC1sZWFzdC14LWRpZmZlcmVudHMtcHJvZHVjdHMtYXJlLXB1cmNoYXNlZD90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.104 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
