1. Home
  2. Knowledge Base
  3. WooCommerce Min Max Quantity and Order
  4. Troubleshooting Min Max Quantity and Order
  5. Disable Add to Cart validation
  1. Home
  2. Knowledge Base
  3. WooCommerce Min Max Quantity and Order
  4. Disable Add to Cart validation

Disable Add to Cart validation

With certain themes, the add to cart button on archive and shop pages doesn’t provide the correct metadata to WooCommerce for our plugin to perform min/max validation.

You can overcome this by disabling the add to cart validation function using the following snippet:

<?php
/**
* Disable add to cart validation for min/max
*/
function prefix_remove_wcmmqo_add_to_cart_validation() {
remove_filter( 'woocommerce_add_to_cart_validation', 'wcmmqo_add_to_cart_validation', 10, 5 );
}
add_action( 'init', 'prefix_remove_wcmmqo_add_to_cart_validation');

Here’s how to add this snippet.

Was this article helpful?