Plugin Author
ILLID
(@mihail-barinov)
Hi,
As I see you are using Astra theme. Please tell me do you use any custom layout for the single product page?
Regards
I use Elementor Pro template for single product page design.
But I canceled the template and used the default template design – the label has not yet appeared
Plugin Author
ILLID
(@mihail-barinov)
Looks like I found the solution for you. Please use following code snippet
add_filter( 'awl_labels_hooks', 'my_awl_labels_hooks' );
function my_awl_labels_hooks( $hooks ) {
$hooks['before_title']['single']['elementor/widget/render_content'] = array( 'priority' => 10, 'type' => 'filter', 'callback' => 'awl_elementor_render_content_single_title', 'args' => 2 );
return $hooks;
}
function awl_elementor_render_content_single_title( $widget_content, $block ) {
if ( is_singular( 'product' ) && $block->get_name() === 'woocommerce-product-title' ) {
$widget_content = AWL_Label_Display::instance()->show_label( 'before_title' ) . $widget_content;
}
if ( is_singular( 'product' ) && $block->get_name() === 'woocommerce-product-images' ) {
$widget_content = AWL_Label_Display::instance()->show_label( 'on_image' ) . $widget_content;
}
return $widget_content;
}
You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.
Regards
I added the code.
And it did not help
Plugin Author
ILLID
(@mihail-barinov)
I see you are using some cache plugin. Please don’t forget to clear the cache.
I clear the cache. and it’s not good
I had the same problem, the archive (shop grid) showed the label but not the single product page.
The code snippet worked for me! *on Astra theme with Elementor Pro*
Btw I had to add two hooks, wp_after_single_product_summary and wp_before_shop_loop_item and now it works just fine.
Thank’s:)