Apply discount to product C only if product A is in cart

  • Posts: 266
  • Thank you received: 35
  • Hikaserial Subscription Hikashop Business
1 week 6 days ago #370213

-- HikaShop version -- : 6.1.0
-- Joomla version -- : 5.3.0
-- PHP version -- : 8.3.28

Is there any way in HikaShop to apply a conditional discount to a specific product based on the presence of other products in the cart?

For example: I sell product A at a fixed price, and if the customer adds both product B and product C to the cart, I want a discount (or coupon) to be applied only to product C.

Does HikaShop support this kind of logic out of the box (discounts, coupons, product rules), or would this require a custom plugin / override?

If custom development is needed, what would be the recommended approach (events/hooks, cart calculation override, or existing extensions)?

Please Log in or Create an account to join the conversation.

  • Posts: 85103
  • Thank you received: 13871
  • MODERATOR
1 week 5 days ago #370216

Hi,

You said:

if the customer adds both product B and product C to the cart, I want a discount (or coupon) to be applied only to product C

I think this is possible with the coupon conditions plugin and clever use of existing coupon restrictions:
www.hikashop.com/marketplace/product/292-coupon-conditions.html
First, you want to create a coupon restricted to product C. With its "Coupon percentage applies to product only" setting activated, the value / percentage of the coupon will apply only to product C and product C will have to be in the cart for the coupon to apply.
www.hikashop.com/support/documentation/i...p-discount-form.html
And in the settings of the coupon conditions plugin, you can then select that coupon, and add the condition:
{product.product_id} == XX
where XX is the id of product B, and with the "OR" logic selected.
This means that the condition applied by the plugin will allow the use of the coupon only if product B is in the cart.

You can even configure several conditions for the same coupon in the plugin to create more complex rules.

The following user(s) said Thank You: oxido

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum