Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1400487

    I would like to move my product category menu widget in the sidebar of my SHOP so that that they are displayed as the first item before the products when viewing on a mobile (there is a previous thread below which is now closed).

    LINK TO WEBSITE: Website
    SCREENSHOT OF WIDGET: Shop widget to move

    PREVIOUS THREAD LINKS:
    Previous Topic thread

    Previous Topic thread 2

    Thank you so much for any help.
    Regards
    Annemarie

    #1400619

    Hey Annemarie,

    Thank you for the inquiry.

    Did you try the css code from the previous threads? You may need to adjust the “.shop_columns_3” selector if you are not using a 3 column layout or if there are more or less columns in your shop page.

    @media only screen and (max-width: 767px) { 
      #main > .container_wrap_first.template-shop.shop_columns_3 > .container {
      display: flex !important; 
      flex-wrap: wrap !important; 
      }
      #main > .container_wrap_first.template-shop.shop_columns_3 > .container > main {
          order: 3 !important; 
      }
      #main > .container_wrap_first.template-shop.shop_columns_3 > .container > aside {
          order: 2 !important; 
      }
      #main > .container_wrap_first.template-shop.shop_columns_3 > .container > header {
          order: 1 !important; 
      }
      }
    

    Best regards,
    Ismael

    #1400656

    Hej Ismael,

    I used your code and it would be perfect if I wanted to move the whole “Aside” so it is placed before “Main”. I only want to move the “product categories” widget and not the all widgets (prod. categories, Latest viewed, etc.). Could the widget be placed inside “Main” before the “template shop content” or is it more major code-wise”?

    Screenshot – Debugger – Product Categories widget css

    Regards,
    Annemarie

    #1400854

    Hi,
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function custom_script() { ?>
      <script>
    window.addEventListener('DOMContentLoaded', function() {
    (function($){
    	var width = $(window).width();
    	if (width <= 767) {
    $( '#top.woocommerce-page.archive' ).each(function() {
    $( this ).find( '#woocommerce_product_categories-3' ).insertBefore( $(this).find('.template-shop.content') );
    });
    }
    })(jQuery);
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'custom_script');

    Then clear your browser cache and check.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.