This PHP code enables you to set a total fixed price if a set quantity of products are purchased from a specific category in WooCommerce.
In this example, we set the product quantity at 4 items in the shoes category and the cart total is modified to a price set at $150 rather than the normal subtotal of $179.96.
You can easily set :
- any price for the cart total
- any product category
- any total quantity
Demo Video
Shows the total price set to a custom value when a set number of products is added from a specific category on the cart page. When the quantity is above or below the set count or the products are not from the set category, the price is not modified and original price is displayed.
Installation
There’s only 1 step :
Copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.
Was This Tutorial Helpful?