I’m looking for a way to apply a discount (percentage) based on cart total weight.
Example:
- 10 to 25 kg, set a 5% discount
- 26 to 50 kg, set a 7,5% discount
- 51 to 100 kg, set a 10% discount
- 101 to 150 kg, set a 12,5% discount
- more than 150 kg, set a 15% discount
When one of the rules will be applied there should be a message also like this payment discount shown in the picture.
Payment method discount
And if also possible showing a message box like the ‘added to cart message box’ which shows how much customers have to order to get the first of a second discounted rule like: Order **kg more and get 5% discount.
I have no idea how to achieve this, so I unfortunately did not tried anything.
Thanks in advance.
Regards,
Vasco
2
Answers
Welcome to StackOverflow!
Here’s a code snippet that answers your question. I only added one weight condition. I believe you’ll be able to fill in the other conditions yourself.
The snippet can be added to your functions.php (as long as it is a child theme, otherwise your code will be deleted after a theme update!) or as a code snippet using plugins such as Code Snippets
You can use a negative fee to make a progressive discount based on cart weight as follow:
Code goes in function.php file of your active child theme (or active theme).
Based on: Add custom fee based on total weight in Woocommerce