• Resolved dpatty

    (@dpatty)


    After setting the default sorting to SKU, the homepage widget “New in” sorts with this default also.

    I need the default sorting for the catalogue to be according to SKU, while the “New in” should show new products.

    How is this done?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    What is this “New in” widget you are referring to?

    Thread Starter dpatty

    (@dpatty)

    Sorry it’s not a widget. It’s part of Storefront’s homepage template. It’s the storefront_recent_products:

    
    <?php
      /**
      * Functions hooked in to homepage action
      *
      * @hooked storefront_homepage_content      - 10
      * @hooked storefront_product_categories    - 20
      * @hooked storefront_recent_products       - 30
      * @hooked storefront_featured_products     - 40
      * @hooked storefront_popular_products      - 50
      * @hooked storefront_on_sale_products      - 60
      * @hooked storefront_best_selling_products - 70
      */
      do_action( 'homepage' ); 
    ?>
    
    • This reply was modified 6 years, 5 months ago by dpatty.
    • This reply was modified 6 years, 5 months ago by dpatty.
    • This reply was modified 6 years, 5 months ago by dpatty.

    Hum, Ok I think I got it now.
    Please add this to your functions.php

    add_filter( 'woocommerce_default_catalog_orderby', function ( $default ) {
    	if ( ! is_shop() ) {
    		return $default;
    	}
    	return 'sku-asc';
    } );

    This will make the default sorting to SKU programmatically, but only on shop page.
    Now you can set the default sorting to most recent.

    • This reply was modified 6 years, 5 months ago by Pablo Pacheco.
    Thread Starter dpatty

    (@dpatty)

    Hi and thanks for the response,

    this didn’t really solve the issue but worked as a workaround. By changing the above filter to this:

    
    add_filter( 'woocommerce_default_catalog_orderby', function ( $default ) {
      if ( ! is_shop() ) {
        return 'date-asc';
      }
      return $default;
    } );
    

    Anytime ??

    Great! Thanks for letting me know.
    I’ll close the ticket then but if you have more questions let me know.

    See you

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Default sorting SKU changes frontpage widgets query’ is closed to new replies.