How to use "auto_apply_to_cart" parameter in unique coupon tag - PrestaShop

What is "auto_apply_to_cart" parameter and how does it work?

When adding this parameter to the coupon tag, it makes the coupon code clickable. When customer clicks the coupon, it will redirect him/her to the shopping cart page and will apply the coupon code automatically to the cart. Yes, it works like a magic ;-)

Unique coupon tag examples (PrestaShop stores)

  • {unique_coupon type="percent" value="15" auto_apply_to_cart="yes" text="Click coupon to get your discount"}
  • {unique_coupon type="percent" value="20" expiry_date="3" minimum_spent="25" }
  • {unique_coupon type="amount" value="10" expiry_date="30" text="Submit this coupon via checkout"}
  • {unique_coupon type="amount" value="25" free_shipping="yes" link="no"}

How to make is work?

In the following file:

<prestashop_root>/controllers/front/CartController.php

Before the end of the init() function (around line 65), add the following 2 lines:

include_once(_PS_MODULE_DIR_ . 'remarkety/RemarketyHelper.php'); 
RemarketyHelper::handleVoucherFromUrl($this);

 

Feel free to send us any question regarding this feature.

Thanks,
Remarkety team



Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.