daily pastebin goal
91%
SHARE
TWEET

WooCommerce - Default order by SKU

lorro Jan 8th, 2017 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   // WooCommerce - default catalog ordering by SKU
  3.   // code goes in functions.php for your child theme
  4.   add_filter('woocommerce_get_catalog_ordering_args', 'catalog_orderby_sku');  
  5.   function catalog_orderby_sku( $args ) {
  6.     $args['meta_key'] = '_sku';
  7.     $args['orderby'] = 'meta_value';
  8.     $args['order'] = 'asc';
  9.     return $args;
  10.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top