This PHP code enables you to add a percentage discount based on a minimum order quantity in WooCommerce. Example :
- Buy a minimum 3 items of a specific product, get a 10% discount on the total.
- The % discount is shown in the cart totals on the cart page.
- The percentage discount is also displayed on the checkout page.
The code enables you to :
- Target 1 or more products by product id
- Set the percentage discount
- Set the quantity
There’s only 2 steps :
1. Copy and paste the PHP code to your child themes functions file or custom functionality plugin.
2. Set your product id'(s) line 16, your percentage discount line 15 and your minimum quantity line 25.
These solutions may also help :