Prerequisites
- I have searched for similar features requests in both open and closed tickets and cannot find a duplicate.
- The feature is still missing in the latest stable version of Elementor ( Elementor Pro. )
What problem is your feature request going to solve? Please describe.
When designing a Single Product template in Elementor Pro, we are unable to specify where WooCommerce notices echo out to, how they look, or when they appear. We end up with all of the WooCommerce notices appearing above the Elementor template, and subsequently breaking our WooCommerce templates. Specifically, it's incredibly annoying to see "product added to cart" above (underneath a transparent) navigation.
The WooCommerce notices echo out into the hook woocommerce_before_single_product
. If we had an element that would echo out the code required into our preferred location using elementor styling, we'd be better able to control how it displays.
Describe the solution you'd like
A simple element that would echo out the code used in the WooCommerce content-single-product.php
template would do the trick. Being able to style the element with Elementor would be ideal. This would allow us to place the notifications wherever we find appropriate based on our templates.
/**
* Hook: woocommerce_before_single_product.
*
* @hooked wc_print_notices - 10
*/
do_action( 'woocommerce_before_single_product' );
https://github.com/woocommerce/woocommerce/blob/3.5.0/templates/content-single-product.php
Describe alternatives you've considered
I don't think there are any alternatives that would complete such a task with such simplicity. Sure, you would engineer the notifications into another element, or add them automatically to some section, but it wouldn't uphold the "customizability" that Elementor promotes so highly.
Additional context
If an element like "WooCommerce Pages" exists, I would expect that other WooCommerce hooks/shortcodes/features would be extended just the same. If I have to dive into a php template, I'm going to assume it should be completed by Elementor and one of its elements.
Add this to your child theme's functions.php file:
remove_action( 'woocommerce_before_single_product', 'woocommerce_output_all_notices', 10 );
Then place a Shortcode Widget anywhere you would like to display notices and paste there this:
[shop_messages]
End.