Multiple Coupons in the URL

  • Posts: 21
  • Thank you received: 2
4 months 4 weeks ago #361699

-- HikaShop version -- : 5.0.4

Hello,

I want to purchase the Multi Coupon Checkout plugin so I can automatically add bonus products when the user clicks the "buy" button.

But does the Multi Coupon Checkout plugin work when the coupons are in the URL?

I'm thinking of using a URL structure like index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&cid=1&Itemid=672&coupon=COUPON1&coupon=COUPON2

Would this apply both coupons automatically and proceed to checkout?
Thanks,

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 3 weeks ago #361701

Hi,

The Multi coupon plugin allows you to have several coupons at the same time in the cart.
However, you can't have several parameters with the same name in an URL.
And HikaShop itself doesn't support having several coupon codes in the add to cart URL.
However, it's possible to do what you want I think.
To do this, you will need to add an extra parameter "url" in your add to cart URL. That parameter should have the add to cart URL with only the second second, and it should be urlencoded.
So, for your example, supposing that your website URL is mywebsite.com , the add to cart URL would something like this:

https://mywebsite.com/index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&cid=1&Itemid=672&coupon=COUPON1&url=https%3A%2F%2Fmywebsite.com%2Findex.php%3Foption%3Dcom_hikashop%26ctrl%3Dproduct%26task%3Dupdatecart%26Itemid%3D672%26coupon%3DCOUPON2
You can use www.urlencoder.org/ to encode the second URL.
This way, the add to cart flow will be like this:
- product with the id 1 is added to the cart
- COUPON1 is added to the cart
- redirected to the URL in the "url" parameter
- COUPON2 is added to the cart
- redirect to the checkout

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

  • Posts: 21
  • Thank you received: 2
4 months 3 weeks ago #361708

Hi, thanks for pointing that out.

Just to confirm, a parameter which is something like coupon=COUPON1+COUPON2 won't work?

Thanks,

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 3 weeks ago #361709

Hi,

It won't work.
If you do that, HikaShop will look for a coupon with the code "COUPON1 COUPON2" and will refuse the coupon code.

The following user(s) said Thank You: brettv

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

Time to create page: 0.054 seconds
Powered by Kunena Forum