Skip to content

Apply discount not seen in docs #1545

Closed Answered by glennjacobs
SebastianBotez asked this question in Q&A
Discussion options

You must be logged in to vote

The Discount Manager caches the discounts per request, so if you're doing something to the cart that will affect the discounts (like applying a coupon code), you will want to reset the discounts.

E.g.

        $discount = $this->coupon_code;
        if (Discounts::validateCoupon($discount)) {

            $this->cart->coupon_code = $discount;
            $this->cart->save();

            Discounts::resetDiscounts();

        }

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SebastianBotez
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants