Home Forums WoodMart support forum WooCommerce Advanced Product Labels conflicting with theme product images

WooCommerce Advanced Product Labels conflicting with theme product images

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #351187

    viribright
    Participant

    To WooCommerce Advanced Product Labels Support:
    On Tue, Feb 1, 2022 at 9:08 PM Kenny Overcast <[email protected]> wrote:
    When on any product page the 2nd and 3rd product image would show like the attached. Although The 1st and 4th images would show correctly. I have deactivated your plugin so the error no longer shows up on my production website. Is there a way for you to fix without a link? I have spoken with woocommerce core, my server host, and my wordpress theme and all of them point to your plugin being the cause of the issue.

    From WooCommerce Advanced Product Labels Support
    I’ve seen something like this before on the Flatsome theme, but not on the theme you’re using. This had to do with the usage of the Flickity slider if I’m not mistaken (its been a while).

    The fix for that was to change the position/priority of where the labels are positioned, a similar solution may be required for your theme:
    // Reposition Flatsome hooks for label output
    add_action( ‘init’, function() {
    if ( function_exists( ‘WooCommerce_Advanced_Product_Labels’ ) ) {
    remove_action( ‘woocommerce_before_shop_loop_item_title’, array( WooCommerce_Advanced_Product_Labels()->single_labels, ‘product_label_template_hook’ ), 15 );
    remove_action( ‘woocommerce_before_shop_loop_item_title’, array( WooCommerce_Advanced_Product_Labels()->global_labels, ‘global_label_hook’ ), 15 );

    add_action( ‘woocommerce_after_shop_loop_item’, array( WooCommerce_Advanced_Product_Labels()->single_labels, ‘product_label_template_hook’ ), 15 );
    add_action( ‘woocommerce_after_shop_loop_item’, array( WooCommerce_Advanced_Product_Labels()->global_labels, ‘global_label_hook’ ), 15 );

    // Single product labels
    remove_action( ‘woocommerce_product_thumbnails’, array( WooCommerce_Advanced_Product_Labels()->single_labels, ‘product_label_template_hook’ ), 9 );
    remove_action( ‘woocommerce_product_thumbnails’, array( WooCommerce_Advanced_Product_Labels()->global_labels, ‘global_label_hook’ ), 9 );

    add_action( ‘flatsome_product_labels’, array( WooCommerce_Advanced_Product_Labels()->single_labels, ‘product_label_template_hook’ ), 15 );
    add_action( ‘flatsome_product_labels’, array( WooCommerce_Advanced_Product_Labels()->global_labels, ‘global_label_hook’ ), 15 );
    }
    }, 5 );

    Your developer may be able to assist in creating the specific customization to find a solution for your theme.

    Can you please customize to find a solution for your theme?

    Attachments:
    You must be logged in to view attached files.
    #351341

    Hello,

    Please try to add this code to the functions.php of the child theme:

    add_action( 'init', function() {
    if ( function_exists( 'WooCommerce_Advanced_Product_Labels' ) ) {
    // Single product labels
    remove_action( 'woocommerce_product_thumbnails', array( WooCommerce_Advanced_Product_Labels()->single_labels, 'product_label_template_hook' ), 9 );
    remove_action( 'woocommerce_product_thumbnails', array( WooCommerce_Advanced_Product_Labels()->global_labels, 'global_label_hook' ), 9 );
    
    add_action( 'woocommerce_before_single_product_summary', array( WooCommerce_Advanced_Product_Labels()->single_labels, 'product_label_template_hook' ), 15 );
    add_action( 'woocommerce_before_single_product_summary', array( WooCommerce_Advanced_Product_Labels()->global_labels, 'global_label_hook' ), 15 );
    }
    }, 5 );

    Best Regards

    #351463

    viribright
    Participant

    Where can I access my child theme?

    #351530

    viribright
    Participant

    why can’t I add a child theme? I provided the css code with the header comment but it is still showing this error.

    Attachments:
    You must be logged in to view attached files.
    #351536

    Hello,

    Please do not create the child theme, it is provided in the theme folder. All you need is just to upload and activate it.

    Best Regards

    #352075

    viribright
    Participant

    Where is the child theme provided in the theme folder? I am in my sftp and cannot find it.

    #352077

    viribright
    Participant

    I found it and your php fix worked great! Thank you!

    #352098

    You are welcome! We are here to help.

    Wish you a wonderful day!

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘WooCommerce Advanced Product Labels conflicting with theme product images’ is closed to new replies.