need help removing action from plugin file

前端 未结 6 1646
醉话见心
醉话见心 2021-01-22 03:10

Hello I am trying to remove an action from a wordpress plugin file. The plugin is called Woocommerce Points and Rewards. I have found the action I want to remove in one of the

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 04:08

    you found a solution for this? having the same problem with another wc plugin ;)

    alright. found an answer in the wc docs. in my case:

    function wc_move_checkout_addons() {
        remove_action( 'woocommerce_checkout_after_customer_details', array( $GLOBALS['wc_checkout_add_ons']->frontend, 'render_add_ons' ) ); 
        add_action( 'woocommerce_checkout_before_customer_details', array( $GLOBALS['wc_checkout_add_ons']->frontend, 'render_add_ons' ) );
    }
    add_action( 'init', 'wc_move_checkout_addons' );
    

    so in your case it should be something like that:

    function wc_remove_message() {
        remove_action( 'woocommerce_before_cart', array( $GLOBALS['wc_points_rewards_cart_checkout']->frontend, 'render_redeem_points_message' ) ); 
    }
    add_action( 'init', 'wc_remove_message' );
    

提交回复
热议问题