Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #840012

    Egis B
    Participant

    Hello,

    WooCommerce on Product Page display Related Product no thumbnail (300×300 px), but resized original product images.

    How to display woocommerce plugin created thumbnails.

    The same situation with Single Thumbnail – displays thumbnail created by X theme, not woocommerce thumbnail 600×600 px.

    The same situation was with shop images.

    I added to child theme functions.php this code:

    //
    // Custom Shop product thumbnails.
    //

    function custom_woocommerce_shop_product_thumbnails() {

    GLOBAL $product;

    $id = get_the_ID();

    $rating = $product->get_rating_html();

    if ( is_product() ) {
    $thumb = ‘entry’;
    } else {
    $thumb = ‘shop_catalog’;
    }

    woocommerce_show_product_sale_flash();
    echo ‘<div class=”entry-featured”>’;
    echo ‘‘;
    echo get_the_post_thumbnail( $id, $thumb );
    if ( ! empty( $rating ) ) {
    echo ‘<div class=”star-rating-container aggregate”>’ . $rating . ‘</div>’;
    }
    echo ‘
    ‘;
    echo “</div>”;

    }

    function remove_x_woocommerce_shop_product_thumbnails(){
    remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘x_woocommerce_shop_product_thumbnails’, 10 );
    add_action( ‘woocommerce_before_shop_loop_item_title’, ‘custom_woocommerce_shop_product_thumbnails’, 10 );
    }
    add_action(‘init’, ‘remove_x_woocommerce_shop_product_thumbnails’);

    // =============================================================================

    How to fix problem with Single Thumbnail and Related Products to use woocommerce thumbnails?

    Live site: http://ambervox.com

    Thanks,
    Egis

    #840584

    Rad
    Moderator

    Hi Egis,

    Thanks for posting in.

    There is a broken format, lot of <a></a> instances without content. The image uses the entry image size instead of the specified shop_catalog.

    Would you mind providing your FTP login credentials as well? I like to check it directly.

    Thanks!

    #841560

    Egis B
    Participant
    This reply has been marked as private.
    #841694

    Zeshan
    Member

    Hi Egis,

    X dynamically compute these image sizes based on your layout size (and it uses the max size). For example, if your inside layout size 980px, then X will deduct spaces, etc. from it and the resulting value will be registered as your image size. So your resulting image size will be like 800px or so. This is to ensure all of your images are of best quality and retina ready.

    Changing these changes back to WooCommerce default ones require custom development. While that is outside the scope of support, I could point you in the right direction with the understanding that it would ultimately be your responsibility to take it from here.

    To change the single shop image size back to default one, in your child theme’s functions.php file:

    // Woocommerce Single Product Image Size - Set Default to 'shop_single'
    // =============================================================================
    
    function remove_single_product_settings_filter() {
      remove_filter( 'single_product_large_thumbnail_size', 'x_woocommerce_single_product_large_thumbnail_size' );
    }
    
    add_filter('init', 'remove_single_product_settings_filter');
    

    Thank you!

    #841774

    Egis B
    Participant

    Thanks,

    2 questions:

    1. What code add to child theme’s functions.php file to display Related Products 300×300 px?

    2. How to ad button Clear Shopping Cart on Cart page?

    Thanks,
    Egis

    #842094

    Rad
    Moderator

    Hi there,

    1. It’s the same as your provided code above. Related products, shop home page, archive, and other sections use the same code to display the product thumbnail. But I can confirm that it’s not changed from your end. Would you mind installing a force regenerate thumbnail and regenerate your thumbnails again? And if you have caching or transients, please clear them.

    2. Maybe this could help you https://wordpress.org/support/topic/add-an-empty-cart-button-to-cart-page

    Button should be added here,

    \wp-content\plugins\woocommerce\templates\cart\cart.php

    while the other code should be added to child theme’s functions.php

    Hope this helps.