How to create product quantity-based conditional payments rule

You can show or hide payment methods, or add a fee, based on the quantity of a specific product or the total quantity in the cart.

Create the rule at WooCommerce > Settings > Payments > Conditions. Use Product Quantity (in Product Specific) for a single product, and Cart Quantity (in Cart Specific) for the whole cart.

How to create the rule

  1. Go to WooCommerce > Settings > Payments, then open Conditions and click Add New. Turn on Status and enter a Rule Name.
  2. In Conditions, choose Product Quantity or Cart Quantity, an operator, and a number. If you use Product Quantity, also add a Product Specific condition such as Product. The form shows a note that the quantity rule will only work if you have selected any one Product Specific option.
  3. In Actions, choose Enable Payments Methods, Disable Payments Method, or in Pro Add Payment Method Fee. Click Save Changes, then test checkout.
A Product Quantity condition set to Greater or Equal to 5, with a note that a Product Specific option is required, a Product condition equal to Chaz Kangeroo Hoodie, and a Disable Payments Method action for Cash on delivery
Figure - A Product Quantity rule that disables Cash on Delivery when the product quantity is 5 or more
Checkout with Chaz Kangeroo Hoodie times 6 and another product, showing Direct bank transfer and Check payments, with an annotation that COD is disabled because the selected product quantity is more than 5
Figure - A checkout page with Cash on Delivery hidden when the product quantity is 6

Pro Tips

  • Always pair Product Quantity with a Product Specific condition such as Product. The red note on the form is required, not optional.
  • Use Cart Quantity when the total units in the cart matter, regardless of which products they are.
  • Number Of Items is a different cart condition. It counts line items, not total units.

Common Use Cases

1. Hide Cash on Delivery above a product quantity

Use Product Quantity Greater or Equal to 5 plus a Product condition, then Disable Payments Method for Cash on delivery, as in the example above.

2. Hide a method when the cart quantity is high

Use Cart Quantity with Disable Payments Method for a method you do not want on large-quantity orders.

3. Add a large-order fee (Pro)

Use Cart Quantity above your threshold with Add Payment Method Fee.

FAQs

1. What is the difference between Product Quantity and Cart Quantity?

Product Quantity is the quantity of a specific product and needs a Product Specific condition as well. Cart Quantity is the total quantity of all products in the cart.

2. Why is there a red note under Product Quantity?

The form says: “This rule will only work if you have selected any one Product Specific option.” Add a Product (or another Product Specific) condition to the same rule.

3. What does the example rule do?

It disables Cash on delivery when Product Quantity is 5 or more for Chaz Kangeroo Hoodie.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.