remove_filter that checks for pre orders


I’ve ready through 5 other questions, and nothing seems to be working for me.

I’m trying to remove the filter for the woocommerce-pre-orders plugin that removes everything else from the cart if you add a pre-order item to it.

I’ve tried it in the child-theme/functions.php file, I’ve added it to it’s own plugin that starts with ‘z’ so that it fires last.

I’ve wrapped it in actions to fire at init and plugins_loaded, with all sorts of different priority numbers. Nothing is happening, except the occasional error when I type some nonsense.

Here’s the truncated code of what I’m trying to get rid of from the plugin:

class WC_Pre_Orders_Cart {

    public function __construct() {

        // Remove other products from the cart when adding a pre-order
        add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_cart' ), 15, 2 );


    public function validate_cart( $valid, $product_id ) {
        return valid;

I’ve tried a few different ways of deploying it, and wrapping it in add_action calls to fire at different times, but it’s possible this remove_filter reference is wrong too. I’ve found 3 different ways to reference the filter in different threads, including:

remove_filter( 'woocommerce_add_to_cart_validation', array( 'WC_Pre_Orders_Cart', 'validate_cart' ), 15 );
remove_filter( 'woocommerce_add_to_cart_validation', array( WC_Pre_Orders_Cart::init(), 'validate_cart' ), 15 );
remove_filter( 'woocommerce_add_to_cart_validation', WC_Pre_Orders_Cart::validate_cart, 15 );

Any guidance is appreciated.

KingRichard 4 months 0 Answers 13 views 0

Leave an answer