Custom Cart Total For Set Number of Items In Specific Product Category – WooCommerce

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.

Download Folder

Related Code Snippets

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.