php - need help removing action from plugin file -


hello trying remove action wordpress plugin file. plugin called woocommerce points , rewards. have found action want remove in 1 of class files. when comment out "add_action" want. trying remove action functions.php in child them. have been reading on , think problem need "globalize" class variable action in; not sure class variable is…

here code adds action (part of file):

class wc_points_rewards_cart_checkout {   /**  * add cart/checkout related hooks / filters  *  * @since 1.0  */ public function __construct() {      // coupon display     add_filter( 'woocommerce_cart_totals_coupon_label', array( $this, 'coupon_label' )      );     // coupon loading     add_action( 'woocommerce_cart_loaded_from_session', array( $this, 'points_last' ) );     add_action( 'woocommerce_applied_coupon', array( $this, 'points_last' ) );      // add earn points/redeem points message above cart / checkout     add_action( 'woocommerce_before_cart', array( $this, 'render_earn_points_message' ), 15 );      add_action( 'woocommerce_before_cart', array( $this, 'render_redeem_points_message' ), 16 );      add_action( 'woocommerce_before_checkout_form', array( $this, 'render_earn_points_message' ), 5 );     add_action( 'woocommerce_before_checkout_form', array( $this, 'render_redeem_points_message' ), 6 );      // handle apply discount submit on cart page     add_action( 'wp', array( $this, 'maybe_apply_discount' ) );      // handle apply discount ajax submit on checkout page     add_action( 'wp_ajax_wc_points_rewards_apply_discount', array( $this, 'ajax_maybe_apply_discount' ) ); } 

the function want remove one:

add_action( 'woocommerce_before_cart', array( $this, 'render_redeem_points_message' ), 16 ); 

so far no luck in getting removed; here have in functions.php:

global $woocommerce, $wc_points_rewards;  /* global $this; */  remove_action( 'woocommerce_before_cart', array( $this, 'render_redeem_points_message' ), 16 ); 

so - sure can done in way @ least have read can done, think have thing wrong on this…

i tried globalizing $this, gave me error message...

if need see entire file or else please let me know…

so hoping on here can me identify doing wrong…

** update monday 8/18 ******** looking class instantiated; have found in "woo commerce-points-and-rewards.php" file; looks may not sure looking at;

  1. does "wc_points_rewards_cart_checkout" instantiated?

  2. and if not sure how use write "remove action" in functions.php...

    private function includes() {

    // product class require( 'classes/class-wc-points-rewards-product.php' ); $this->product = new wc_points_rewards_product();  // cart / checkout class require( 'classes/class-wc-points-rewards-cart-checkout.php' ); $this->cart = new wc_points_rewards_cart_checkout();  // order class require( 'classes/class-wc-points-rewards-order.php' ); $this->order = new wc_points_rewards_order();  // discount class require( 'classes/class-wc-points-rewards-discount.php' ); $this->discount = new wc_points_rewards_discount();  // actions class require( 'classes/class-wc-points-rewards-actions.php' ); $this->actions = new wc_points_rewards_actions();  // manager class require( 'classes/class-wc-points-rewards-manager.php' );  // points log access class require( 'classes/class-wc-points-rewards-points-log.php' );  if ( is_admin() )     $this->admin_includes(); } 

thanks much...

try this:

// use class name instead of globalized $this remove_action( 'woocommerce_before_cart', array( 'wc_points_rewards_cart_checkout', 'render_redeem_points_message' ), 16 ); 

as $this internal referrer class used in, globalizing may not thing.

does plugin allow extend class own , use instead?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -