• Whichever image I set as product image appears twice in the gallery, and if I leave it blank then it goes to the shop placeholder image for the product image. But if I set a global default, it appears twice in the gallery too. How can I have one of the images already in the gallery as the default?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    Could you provide us with screenshots of the configuration that you mention and how it looks? You can send them via WeTransfer if you wish.

    In any case, the option to show a default image for all Gift Card type products is only available in our Premium version.

    We will be attentive to any news.

    Best regards.

    Settings within product:
    https://snipboard.io/be9Wp2.jpg

    Output:
    https://snipboard.io/HtYQIF.jpg

    If I leave the product image blank, the output is:
    https://snipboard.io/OoZhB3.jpg
    – note that although this resolves the duplicate display issue, the default selected gift card image is nothing (to the left of the first image), thus showing the placeholder image

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,

    We couldn’t reproduce the error in our installation, so could you provide us with a link to a gift card type product where this problem occurs?

    We will be attentive to your response.

    Best regards.

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello Scott,
    sorry for the delay.

    In order to fix the duplicate image when you set a main image for your product, add the following code in the functions.php file of your active child theme:

    if ( ! function_exists( 'yith_ywgc_enqueue_scripts_custom' ) ) {
        function yith_ywgc_enqueue_scripts_custom() {
            $jquery = 'jQuery( document ).ready( function( $ ){
            
                let id_default_img = $( ".gift-card-content-editor li .ywgc-preset-image.ywgc-default-product-image.selected_image_parent" ).data( "design-id" );
                $( ".gift-card-content-editor li .ywgc-preset-image" ).not( ".ywgc-default-product-image.selected_image_parent" ).each(function() {
                    if ( jQuery( this ).data( "design-id" ) == id_default_img ) {
                        jQuery( this.remove() );
                    }
                });
            });';
    
            wp_add_inline_script( 'ywgc-frontend-script', $jquery );
        }
     
        add_action( 'wp_enqueue_scripts', 'yith_ywgc_enqueue_scripts_custom', 999 );
    }

    Check it out and tell us if it works well for you, please.

    Best regards.

    Thank you – that code snippet resolves the issue – hoping it will be included in a future release

    All the best

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Duplicate Image’ is closed to new replies.