Alphabetical Sorting Product
-
Hello, I need some help.
I need to sort the woocommerce product archive alphabetically. At the moment I have mostly succeeded with an additional string to the default woocommerce sorting, but I still have 5-6 products left that do whatever they want.The snippet I’m using is this:
1) `*Ordine Alfabetico Prodotti*/
function quadlayers_alphabetical_shop_ordering( $sort_args ) {
$orderby_value = isset( $_GET[‘orderby’] ) ? woocommerce_clean( $_GET[‘orderby’] ) : apply_filters( ‘woocommerce_default_catalog_orderby’, get_option( ‘woocommerce_default_catalog_orderby’ ) );
if ( ‘alphabetical’ == $orderby_value ) {
$sort_args[‘orderby’] = ‘title’;
$sort_args[‘order’] = ‘asc’;
$sort_args[‘meta_key’] = ”;
}
return $sort_args;
}
add_filter( ‘woocommerce_get_catalog_ordering_args’, ‘quadlayers_alphabetical_shop_ordering’ );`2) /*Creazione casello*/
function quadlayers_custom_wc_catalog_orderby( $sortby ) {
$sortby[‘alphabetical’] = ‘Sort by Name: Alphabetical’;
return $sortby;}
add_filter( ‘woocommerce_default_catalog_orderby_options’, ‘quadlayers_custom_wc_catalog_orderby’ );
add_filter( ‘woocommerce_catalog_orderby’, ‘quadlayers_custom_wc_catalog_orderby’ );`I don’t understand why they are all in alphabetical order except some …
The page I need help with: [log in to see the link]
The topic ‘Alphabetical Sorting Product’ is closed to new replies.