- Posts: 48
- Thank you received: 5
Multiple Coupons in the URL
2 years 3 months ago #361699
by brettv
Multiple Coupons in the URL was created by brettv
-- 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,
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.
2 years 3 months ago #361701
by nicolas
Replied by nicolas on topic Multiple Coupons in the URL
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:
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
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:
Code:
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
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.
2 years 3 months ago #361708
by brettv
Replied by brettv on topic Multiple Coupons in the URL
Hi, thanks for pointing that out.
Just to confirm, a parameter which is something like coupon=COUPON1+COUPON2 won't work?
Thanks,
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.
2 years 3 months ago #361709
by nicolas
Replied by nicolas on topic Multiple Coupons in the URL
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.
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.166 seconds