1. WooCommerce Quantity Manager
  2. Developer Documentation

Actions and Filters

WooCommerce Quantity Manager comes with a number of filters which allow you to customize the plugin's behavior.

Please note that this code is aimed at developers and if you don't know how to use it then you should ask your developer.

Need professional assistance?
We've partnered with Codeable to provide our customers with expert help if required.

Filters

wc_quantity_manager_handle_add_to_cart_validation

This filter allows you to disable the add to cart validation checks. It uses the same parameters as the WooCommerce core woocommerce_add_to_cart_validation filter, so you can conditionally disable it as well.

add_filter( 'wc_quantity_manager_handle_add_to_cart_validation', function( $enabled, $product_id, $quantity, $variation_id, $variation ) {
    return false;
}, 10, 5 );

wc_quantity_manager_handle_cart_validation

This filter allows you to disable the add to cart validation checks. You can access the global WC()->cart  here if you want to dp this conditionally.

add_filter( 'wc_quantity_manager_handle_cart_validation', function( $enabled ) {
    return false;
} );

wc_quantity_manager_default_quantity_rule_value

This filter allows you to modify the calculate rule value for the default quantity.

add_filter( 'wc_quantity_manager_default_quantity_rule_value', function( $rule_value, $rule ) {
    return 1;
}, 10, 2 );

wc_quantity_manager_quantity_step_rule_value

This filter allows you to modify the calculate rule value for the quantity step.

add_filter( 'wc_quantity_manager_quantity_step_rule_value', function( $rule_value, $rule ) {
    return 1;
}, 10, 2 );

wc_quantity_manager_quantity_rules_rule_value

This filter allows you to modify the calculate rule value for the min and max quantity rules

add_filter( 'wc_quantity_manager_quantity_rules_rule_value', function( $rule_value, $rule ) {
    return [
        'min' => 1,
        'max' => 10,
    ];
}, 10, 2 );

wc_quantity_manager_values_rules_rule_value

This filter allows you to modify the calculate rule value for the min and max value rules.

add_filter( 'wc_quantity_manager_value_rules_rule_value', function( $rule_value, $rule ) {
    return [
        'min' => 1.99,
        'max' => 10,
    ];
}, 10, 2 );

Related Articles

Still need help?
If searching the knowledge base hasn't answered your question, please contact support.