Really hope somebody can help me out.
I'm using WordPress with WooCommerce. We just connected our POS system Lightspeed to Woocommerce, using the Woocommerce Lightspeed Plugin made by WooCommerce.
Long story short, the plugin enters all the variations in the wrong order when bringing the products over! We can't possibly go through the thousands of products to change the order of the variations... so I was wondering how I could override the custom variation order and make it ordered alphabetically.
Trying to find an answer to the issue I found this code:
function my_custom_wc_get_variations_args( $args ) {
$args['order'] = 'ASC';
return $args;
}
add_filter( 'woocommerce_ajax_admin_get_variations_args', 'my_custom_wc_get_variations_args' );
I cannot figure out how to make this work though. Someone in another thread said something to the same effect but wasn't clear on exactly how to use it.
In woocommerce/includes/class-wc-ajax.php there is a method on the WC_AJAX class responsible for loading variations called load_variations, it contains only one hook, which is a filter, named woocommerce_ajax_admin_get_variations_args which fires early in the method.