Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #453664

    Hi

    I want to move, on single product pages, the product image from the sidebar (leaving categories tree in it) to the single product summary, just between description and metas…

    But I don’t really understand where I have to modify the code. I’m fluent with “classical” wordpress templates, but it’s my first time with Woocommerce and it’s slightly difficult !!!

    Sorry for my bad english :-p

    With my best regards

    Cédric (France)

    #454209

    Hi,

    Can you post the link to one of your Products please?

    Regards,
    Josue

    #454282
    This reply has been marked as private.
    #454791

    Hi,

    Try adding this at the very end of your theme / child theme functions.php file:

    function add_custom_script(){
    if(is_singular('product')){
    ?>
    <script>
    (function($){
        $(window).load(function() {
        	$(".single-product-summary .summary").after($(".single-product-main-image .images").detach());
        });
    })(jQuery);
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Josue

    #454834

    Mmmmmhhh… yes it works BUT it’s a javascript solution :-p

    I want to find a pure PHP solution.

    #454838

    Is there any particular reason for that? if you’re concerned about SEO don’t be as the image is being moved between div elements (not headings or other key SEO elements).

    Regards,
    Josue

    #455123

    Yes

    That’s why I wanted to move the image (alone, only resizable for responsive, not extendable larger than its original size) just between the short description and the reference’s block… But in the same div ;-)

    #455590

    Hi!

    Add this in the functions.php file:

    #
    # removes the default post image from shop overview pages and replaces it with this image
    #
    function avia_woocommerce_thumbnail_mod($asdf)
    {
    	global $product, $avia_config;
    	$rating = $product->get_rating_html(); //get rating
    
    	$id = get_the_ID();
    	$size = 'shop_catalog';
    
    	echo "<div class='thumbnail_container'>";
    		echo avia_woocommerce_gallery_first_thumbnail( $id , $size);
    		echo get_the_post_thumbnail( $id , $size );
    		if(!empty($rating)) echo "<span class='rating_container'>".$rating."</span>";
    		if($product->product_type == 'simple') echo "<span class='cart-loading'></span>";
    	echo "</div>";
    }
    
    add_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_thumbnail_mod' );
    remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
    remove_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail', 20);

    Cheers!
    Ismael

    #455849

    MMmmhhh ah yes it’s a good solution, I just want the original size image and not the thumbnail, but for this I think I’ll easily find the solution :-)

    Thanks !!!

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘[Woocommerce] How to move image product from sidebar to product summary ?’ is closed to new replies.