Today we will learn how to create coupon in Opencart and how to apply coupon at the time of checkout. In Opencart admin has to create a coupon for the customer and sends a coupon code to the customer. Admin can create percentage or fixed type coupon and can set the discount amount of the coupon. Admin can choose product as well as categories for which the coupon can be applied.
Admin can set the coupon validity in which coupon can be applied by the customer.
When customer apply the coupon in the “checkout/cart” page and click the “Apply Coupon” button then a “coupon” function of the “total/coupon” controller is called through AJAX call.
In the function Opencart gets the details of the coupon and save the coupon code in the session by an index name “coupon”.
After the saving in the session Opencart reload the “checkout/cart” page for apply the coupon to the customer cart.
Be the first to comment.