• Resolved project13x

    (@project13x)


    I want to use the following filter hook:

    $validate=mwb_sfw_add_to_cart_validation’,false,$product_id,$quantity);
    and set it to true instead of false.

    But i am a bit confused how to set up the add_filter function.

    I made a beginning but this is not working.
    function custom_filter( $validate ) {
    $validate = apply_filters( ‘mwb_sfw_add_to_cart_validation’, true, $product_id, $quantity );
    return $validate;
    }
    add_filter( ‘mwb_sfw_add_to_cart_validation’, ‘custom_filter’);

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Thanks for using our plugin!

    You can write code something like this to return the true value

    function custom_filter( $validate, $product_id, $quantity ) {
    return true;
    }
    add_filter( ‘mwb_sfw_add_to_cart_validation’, ‘custom_filter’, 10, 3);

    Thanks,

    Thread Starter project13x

    (@project13x)

    Thank you for quick feedback!

    That worked ??

    Hi,

    Thanks for your appreciation, We are glad to hear that your concern is resolved, if you are happy with our support and plugin then you can put your kind words as a 5-star review over the review section,

    The team will surely appreciate your feedback

    Kind Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to use a Filter Hook’ is closed to new replies.