Sort Products by SKU Number

Anonymous asked 4 years ago

Hi Max, Can I sort products in WEooCommerce by the SKU number? 

Sort Products by SKU Number was last modified: July 24th, 2015 by Anonymous

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips

Tips

Cool People Share:
0 Answers
Maximus Mccullough Staff answered 4 years ago

Yes you sure can. Open up your functions.php file in your child theme. If you are in your dashboard go to APPEARANCE > EDITOR > from the list of files on the far right look for functions.php
Add this line of code at the end of the file. 

add_filter('woocommerce_get_catalog_ordering_args', 'wcs_woocommerce_catalog_orderby_sku');
function wcs_woocommerce_catalog_orderby_sku( $args ) {
        $args['orderby'] = 'meta_value';
        $args['meta_key'] = '_sku';
}
Answer for Sort Products by SKU Number was last modified: July 24th, 2015 by Maximus Mccullough

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips

Tips

Cool People Share: