• Hi, I would like to move some notification from a hook to another from a child theme, example :

    remove_action( 'woocommerce_before_single_product', 'check_cart_items', 9);
    add_action( 'woocommerce_single_product_summary', 'check_cart_items', 1 );

    How is it possible to do this !?
    The theme that I use is not very compatible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author James Golovich

    (@jamesgol)

    What theme are you using?

    You could try something like the following untested code:

    $csr = WC()->integrations->get_integration('woocommerce-cart-stock-reducer');
    remove_action( 'woocommerce_before_single_product', array( $csr, 'check_cart_items' ), 9);
    add_action( 'woocommerce_single_product_summary', array( $csr, 'check_cart_items' ), 1 );
    Thread Starter Chritchan

    (@chritchan)

    Thanks for your reply.
    I’m using Goya. I’ve dropped your snippet in the function.php of the child theme and here is the error :

    Fatal error: Uncaught Error: Call to a member function get_integration()

    Plugin Author James Golovich

    (@jamesgol)

    Since it’s not a public theme if you send me a copy I can take a look.

    You can’t just drop that into your functions.php or it gets executed before WooCommerce is loaded and before the actions are added. It would need to be called after the WooCommerce integrations are loaded and I don’t know offhand during what hook that happens.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove_action’ is closed to new replies.