Craft CMS Asked on December 28, 2020
TL;DR : Free shipping on order discounts don’t appear as a discount (or any type of) adjuster. So how do I check if a free shipping discount has been applied?
Sorry for the long post – hopefully it explains what I’m trying to achieve!
I have a custom module that shows and hides shipping options depending on a few factors.
At the moment the client has a discount that allows Free Shipping on all orders over $200. They have set this up and ticked the "Remove all shipping costs from the order"
This is working well and no shipping is being applied correctly at the right time. However the only thing that shows you have free shipping is that the shipping price is 0.
To make it clearer to the user I’d like to display a notice to show they are getting free shipping. I can’t do this using the shipping total as that may be zero simply because they haven’t selected anything yet.
So my idea was that I could use the adjusters to check if the discount was being applied, but this type of discount doesn’t seem to appear in the list of adjusters. Here are a couple of scenarios where I have listed all adjusters:
1.) Order with normal shipping applied: – shipping and tax adjusters applied.
2.) Order over $200 (free shipping) – only tax adjuster applied.
3.) Order over $200 (free shipping) and 10% discount applied.
So my question is how do I detect that a free shipping discount has been applied to an order? Should the discount appear as an adjuster? Is there a different way to detect what discounts have been applied?
Thanks
For anyone else viewing this question - until there is a zero value adjuster as mentioned by Luke, my solution has been to simply do the discount checks in my custom module.
A little messy but it'll do the job for now.
Answered by Emily Fitton on December 28, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP