This little snippet checks the Woocommerce basket total and calculates how much more the customer needs to spend to get a free offer. In this case, the free offer is free shipping.
You can add this message using a hook to the top of the basket page. I’m using Generatepress on the site I wrote this for, so the hook for this is generate_before_content. Generatepress really does make this very easy. Otherwise you can read up on hooks here.
The message changes once they reach the required total, to show that they’re entitled to the offer.
NB if your offer is free shipping, you should set it up to apply the free shipping automatically once the total is reached.
I know you can do this with plugins but I wrote this for a site that has too many plugins already (and then used it on my own jewellery site, as you can see!). Only a little code is needed, so why bother with adding yet another plugin. Hope this is useful – comments and suggestions welcome!!!
You can add some styling of course:
.freebies {background-color:#e8f2ff}
.freebies span {font-size:0.8em}
Leave a Reply