Support » Plugin: Hyyan WooCommerce Polylang Integration » How to remove a filter?

  • Resolved nicmare

    (@nicmare)


    i need to remove this filter from your cart.php:
    add_filter('woocommerce_cart_item_product', array($this, 'translateCartItemProduct'), 10, 2);

    How do i access it? this won’t work:
    remove_filter(woocommerce_cart_item_product', array("cart", 'translateCartItemProduct'));

    I don’t want to change your core files. Therefore any help is appreciated!

    • This topic was modified 3 years, 7 months ago by nicmare.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello?

    Found a nice fix. Since WordPress 4.7 you need to insert this in your functions.php:

    // disable the hyyan filter which causes some problems
    function remove_hyyan_filter(){
        global $wp_filter;
        write_log($wp_filter["woocommerce_cart_item_product"][10]);
        if(isset($wp_filter["woocommerce_cart_item_product"][10])){
            foreach($wp_filter["woocommerce_cart_item_product"][10] as $key => $hook){
                if($hook["function"][1] == "translateCartItemProduct") unset( $wp_filter["woocommerce_cart_item_product"]->callbacks[10][$key]);
            }
        }
    }
    add_action( 'wp', 'remove_hyyan_filter' );

    Hello,

    sorry for the late reply. I’m happy to read that you have found a way to solve your issue.

    I just check the plugin code and notice that the implementation don’t allow for a easy way to remove filters and actions. I have created a new issue here to make sure every class was a way to retrieve the instance that can be used afterwards to remove the filters.

    I hope this will come out in a future release.

    Plugin Contributor jonathanmoorebcsorg

    (@jonathanmoorebcsorg)

    Hi, I am closing from here as we are not using this support forum, further discussion is on https://github.com/hyyan/woo-poly-integration/issues/101

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to remove a filter?’ is closed to new replies.