I have a Woocommerce website and when customer add-to-cart a product, it is get redirected to checkout page, so cart page is not accessible.
I would like to apply coupon via URL (GET) on checkout page, with something like:
https://example.com/?coupon_code=highfive
.
When customer click this url then the coupon code is stored in browser sessions. Then if he add-to-cart any product then the coupon is applied into checkout page.
Is this possible?
Any help will be appreciated.
Update2: This can be done in a very simple way with the following 2 hooked functions:
Here is this code:
Code goes in function.php file of the active child theme (or active theme).
Tested and works