• Hey,
    I use your plugin.
    At the moment the label is only visible on the product archive page.
    And not seen on product page.

    why?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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

    Thread Starter b8676544

    (@b8676544)

    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

    Thread Starter b8676544

    (@b8676544)

    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.

    Thread Starter b8676544

    (@b8676544)

    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:)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Label display on product page’ is closed to new replies.