Skip to main content

Auto Apply Coupon

More
8 years 9 months ago #283836 by mikekiy
Auto Apply Coupon was created by mikekiy
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.

More
8 years 9 months ago #283837 by nicolas
Replied by nicolas on topic Auto Apply Coupon
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.

More
8 years 9 months ago #284884 by mikekiy
Replied by mikekiy on topic Auto Apply Coupon
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.175 seconds
Powered by Kunena Forum