Im trying to do exactly as the title says, one of the latest releases has changed from this:

public function __construct() {

    // add single product message immediately after product excerpt
    add_action( 'woocommerce_single_product_summary', array( $this, 'render_product_message' ) );

    // add variation message before the price is displayed
    add_action( 'woocommerce_single_product_summary', array( $this, 'add_variation_message_to_product_summary' ), 15 );

    // add the points message just before the variation price.
    add_filter( 'woocommerce_variation_price_html', array( $this, 'render_variation_message' ), 10, 2 );
    add_filter( 'woocommerce_variation_sale_price_html', array( $this, 'render_variation_message' ), 10, 2 );

    // Check for same price but variable points
    add_filter( 'woocommerce_available_variation', array( $this, 'check_for_variable_points_in_product' ) );

    // delete transients
    add_action( 'woocommerce_delete_product_transients', array( $this, 'delete_transients' ) );
}

to this:

public function __construct() {

    // add single product message immediately after product excerpt
    add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'render_product_message' ), 15 );

    // add variation message before the price is displayed
    add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_variation_message_to_product_summary' ), 25 );

    // add the points message just before the variation price.
    add_filter( 'woocommerce_variation_price_html', array( $this, 'render_variation_message' ), 10, 2 );
    add_filter( 'woocommerce_variation_sale_price_html', array( $this, 'render_variation_message' ), 10, 2 );

    add_filter( 'woocommerce_show_variation_price', '__return_true' );

    // delete transients
    add_action( 'woocommerce_delete_product_transients', array( $this, 'delete_transients' ) );
}

I’m trying to address the first to add_actions’s firstly to remove and then insert back in the original position.

Annoyingly there is little documentation on the net about this, so with what ive been able to read and the plugins core / template files only have one mention of this which is what ive pasted in.

My code doesn’t work, I’ve added this directly to the themes functions.php and tried several variations all with no luck. Below is what ive come up with so far…

1.

 remove_action( 'woocommerce_before_add_to_cart_button', array( $this, 'render_product_message' ), 15 );
    remove_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_variation_message_to_product_summary' ), 25 ); 

2.

remove_action( 'woocommerce_before_add_to_cart_button', 'render_product_message', 15 );
remove_action( 'woocommerce_before_add_to_cart_button', 'add_variation_message_to_product_summary', 25 );

Read more here: Woocommerce Points and Rewards – remove / add action to move render_product_message


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: