Solved

Automatically applying WooCommerce coupons

  • 6 September 2023
  • 3 replies
  • 296 views

Badge +2

Hey,

 

I’m trying to add a link to my abandoned cart and checkout flows that automatically applies a coupon code on the click of a link. Is this possible? 

 

I’ve tried:

{{ organization.url }}/?wt_coupon/{% coupon_code 'CouponName' %}/cart?wck_rebuild_cart={{ event.extra.CartRebuildKey }}

{{ organization.url }}/discount/{% coupon_code 'CouponName' %}/cart?wck_rebuild_cart={{ event.extra.CartRebuildKey }}

 

When I click on the link it takes me to the site on a 404 page and it reads that the coupon code couldn’t be found, despite making it within Wordpress/WooCommerce? 

 

Can you see where I’m going wrong?

 

Thank you :)

icon

Best answer by Taylor Tarpley 7 September 2023, 06:50

View original

3 replies

Userlevel 7
Badge +60

Hi @Tobi Chapman

 

Thanks for you question! Happy to help! 

 

Nice job so far! You are using the correct  base syntax for recreating an abandon cart for Woocomerce. The reason you’re running into issues is because, regrettably, it is not possible to automatically apply coupons to a WooCommerce checkout. I’m very sorry for the inconvenience this may cause! I’ve done some digging and have come across the following  wordpress plugin that might be helpful! 

 

I will submit this as a feature request on your behalf! Thank you for participating in the Community!

-Taylor 

Userlevel 1
Badge +1

Hi Tobi,

I’m new here to the community but I had this same question, which is how I came across your thread. I’ve been doing some trial and error on my side and got the coupon code to auto apply and rebuild the cart. Because of my success, I thought it would be beneficial to share.

We are running a WooCommerce, and use a plugin called Smart Coupons. That plugin creates the ability to auto apply coupons via link. With that plugin installed, here is how I had my link stuctured to apply the coupon and rebuild the customers cart.

{{ organization.url|trim_slash }}/cart?coupon-code=YOURCOUPONCODEHERE&wck_rebuild_cart={{ event.extra.CartRebuildKey }}

Hopefully that is of help to you and others who come across this question!

-Shane

Userlevel 7
Badge +60

Hi @shanermp

 

Thank you so much for sharing your insight so it can help your peers who might be struggling with this issue as well! This is what a Community is all about!

 

-Taylor 

Reply