Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1361262

    Hi,

    I would like to move the product description below the image product on screens between 767px and 1200px. Is it possible to do this ?
    Thank you very much,

    Best regards

    Audrey

    #1361279

    Hey Audrey,

    Thanks for contacting us!

    Please add following code to Quick CSS field in Enfold theme options > General Styling tab

    
    @media only screen and (max-width: 1200px) {
    .single-product-main-image {
      width: 100%;
      margin-right: 0;
      float: none;
    }}
    

    Cheers!
    Yigit

    #1361317

    Hi Yigit,

    Sorry, I wasn’t clear enough. I would like to keep the product name, price and add to cart button on the right of the image. Only the description and customer reviews are below, in 100% width.

    Is that possible ?

    Thank’s a lot,

    Audrey

    #1361437

    Hi,

    Thank you for the clarification.

    You can use this code in the functions.php file to move the product tabs below the product image and make it fullwidth.

    function av_woo_tabs_below() {
        remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 );
        add_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 20 );
        }
    add_action( 'init', 'av_woo_tabs_below');
    

    Best regards,
    Ismael

    #1361451

    Hi,

    I want to move the product tabs below the product image and make it fullwidth, only on screens between 767px and 1200px (as I wrote in my first message). Is it possible ?
    In screens smaller than 767px and larger than 1200p I want to keep the default behaviour.

    Thank you,
    Best regards,

    Audrey

    #1361648

    Hi,
    Thanks for your patience, please try this code to the end of your child theme functions.php file in WordPress ▸ Appearance ▸ Theme File Editor instead:

    function custom_script_move_woo_tabs() { ?>
      <script>
    window.addEventListener('DOMContentLoaded', function() {
    (function ($) { 
        var width = $(window).width();
    if (width > 767 && width < 1200) {
    	$('#top.single-product .woocommerce-tabs.wc-tabs-wrapper').css({'padding-top':'0'}).appendTo( ".container_wrap_first.template-shop > .container > .product" );
    	$('#top.single-product .single-product-main-image').css({'padding-bottom':'0'});
       }
    })(jQuery); 
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'custom_script_move_woo_tabs');

    this only works on screens between 767px and 1200px as asked, please copy the css from the forum and not from an email notification so the greater than symbol is copied correctly.
    Also note that if you test on a desktop screen by resizing the window you will need to refresh the widow to trigger the script, this would not be an issue for an actual user.
    Here is the expected results between 767px and 1200px with the tabs moved:
    single-product-with-woo-tabs-moved-below-product-image-full-width.jpg
    this is when the screen is larger than 1200px:
    single-product-with-woo-tabs-in-default-location.jpg
    I have linked to my test page below, please give this a try.

    Best regards,
    Mike

    #1361683

    Hi Mike,

    Thank you very much. Your solution would be perfect if it also worked when the window is resized. It bothers me that we have to refresh the page for this to work. But thank’s anyway.

    Is it possible to adapt Ismael’s code so that it works for screens below 1200px ? This means placing the title, price, add to cart button and description below the image, just like on the mobile version.

    Thank you again,
    Best regards,

    Audrey

    #1361698

    Hi,
    Glad to hear that this helped, Ismael’s solution is a PHP function and works on the server side while the page is being built, but getting the browser screen size needs to be done on the client side with javascript after the page is built, so this won’t work.
    I can add a function to account for screen resizing, but it just auto reloads the page on resize and in a live situation the user would not trigger this because their devices would not change from desktop to tablet on the fly. Originally I thought you asked for the product tabs below the product image and make it fullwidth, in your last post you asked to have the title, price, add to cart button and description below the image, just like on the mobile version, so for this I have also added the resize function.
    Try this code to the end of your child theme functions.php file in WordPress ▸ Appearance ▸ Theme File Editor instead:

    function move_woo_product_summary_below_image_with_resize() { ?>
        <script>
    window.addEventListener('DOMContentLoaded', function() {
        (function ($) { 
            var width = $(window).width();
        if (width > 767 && width < 1200) {
          $('#top.single-product .woocommerce-tabs.wc-tabs-wrapper').css({'padding-top':'0'}).appendTo( ".container_wrap_first.template-shop > .container > .product" );
          $('#top.single-product .single-product-summary .entry-summary').css({'padding-top':'0'}).insertBefore( ".container_wrap_first.template-shop > .container > .product .woocommerce-tabs.wc-tabs-wrapper" );
          $('#top.single-product .single-product-main-image').css({'padding-bottom':'0','width':'100%'});
           }
        })(jQuery);
        var resizeId;
        window.addEventListener('resize', function() {
            clearTimeout(resizeId);
            resizeId = setTimeout(doneResizing, 300);
        });
        
        function doneResizing(){
            location.reload();
        }
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'move_woo_product_summary_below_image_with_resize');

    Below I have linked to my test page, I tested with a Dev Tools device emulation of a device 1024px by 1205px to test the resize by rotating portrait to landscape and back.
    For portrait:
    2022-08-15_001.jpg
    For landscape:
    2022-08-15_002.jpg
    Please give this a try.

    Best regards,
    Mike

    #1361705

    Hi Mike,

    Perfect !! Thank you so much !
    You can close this ticket,

    Have a good day and thank’s again,

    Best regards,

    Audrey

    #1361714

    Hi,

    Great, I’m glad that Mike could help you out. I’ll close this thread for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Move the product description below the image product on tablet only’ is closed to new replies.