Skip to content
Advertisement

Disable payment gateway based on number of items and product category in WooCommerce cart

I am using the following code, which allows me to set a minimal quantity of products in cart to proceed payment

JavaScript

Is there some option to exclude some specific category?

For example:

I need to set the minimum quantity for one order for 6 pieces of goods (applies to all categories).

For one category of products (ID 2), however, I want that if there are only goods from this category in the basket, set the minimum for the order to 3 pieces.

Any advice?

Advertisement

Answer

This answer contains:

  • If a product does not belong to the specific category, the minimum quantity will be 6
  • If all products do belong to that one category, the minimum quantity will be 3

So you get:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement