1
votes

I am trying to re-position the Woocommerce message

"X Product" HAS BEEN ADDED TO YOUR CART.

But with no success. I tried with the hooks like these

remove_action( 'woocommerce_before_single_product', 'wc_print_notices', 10 );
add_action( 'woocommerce_before_single_product_summary', 'wc_print_notices', 10 );

The above did not work at all.

Any suggestion will be appreciated.

Edit

I also tried to call the template tag directly in the content-single-product.php file somewhere at the bottom like this

<?php wc_print_notices(); ?>

Still no message shows at the desired place.

<div class="summary entry-summary">

<?php
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action( 'woocommerce_single_product_summary' );
?>

</div><!-- .summary -->

<php wc_print_notices();?>
1

1 Answers

0
votes

To remove it you could just hide it with CSS:

.woocommerce-message, .woocommerce-info { display:none; }

Or to reposition:

//Remove Message:
remove_action( 'woocommerce_before_single_product', 'woocommerce_show_messages' );

//Show message call this function where you want the message displayed
woocommerce_show_messages();