Auto Apply Coupon

  • Posts: 56
  • Thank you received: 1
  • Hikashop Business
1 year 1 week ago #283836

Hello,

We need to check if X coupon is active and if so apply another Coupon. Whats the best plugin method to hook into to do this?

Many thanks

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

  • Posts: 64160
  • Thank you received: 9258
  • MODERATOR
1 year 1 week ago #283837

Hi,

The best is to use the cart API of HikaShop:
www.hikashop.com/support/documentation/6...fterCartProductsLoad
With the onAfterCartProductsLoad trigger, you can simply set the coupon code in the cart_coupon attribute of the $cart object given to you and HikaShop will load it automatically for you in the cart provided that the coupon code is valid.
Basically, it would do the same as the "auto load in cart if possible" setting of the coupons.
If you want something more complex, you might want to use the "additional" system instead of the coupon system.
You will have a lot more liberty.
You can use that plugin as an example:
www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511

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

  • Posts: 56
  • Thank you received: 1
  • Hikashop Business
11 months 3 weeks ago #284884

Yes the problem with this was you only support 1 coupon. But Since this coupon was to provide freeshipping I've been able to auto-zero the shipping if X Y or Z coupon is in using the onAfterCartShippingLoad function.

Thanks for your pointers!

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

Time to create page: 0.074 seconds
Powered by Kunena Forum