Ok I know it’s might be a silly question or you may think it was asked dozen times. but either I am desperate and missed something or this is some unique problem. Anyway, I need your help.
My client wanted to show her products in an alphabetic way. All was good when I select Default Product Sorting “Custom ordering + Name”
But then something messed up.. and all alphabetic order in “Sort Products” Screen gone. Now they all shown according to their “Order” number.
Is there any way to make products return back to list in an alphabetic order?
I’d do it manually in “Sort Products” but there are about 100 products, and I am not sure when the client will add new products the problem won’t come back.
EDIT
I’ve found out that when you are using Default sorting (Custom order + Name) at the beginning all products shown by default in alphabetic order, however once you move one item out of the alphabetic order(e.g one “F” item placed in front of an “A” item) all order messed up, and follows only ordering according to product’s order number
To expand on @Vikas_Gautam’s answer and modify it to sort by post title, you would do the following:
Take a look at the Codex for WP_Query sort parameters.
To expand on @helgatheviking’s answer, I tried that and it sorted in (descending) alphabetical order but only if the Alphabetical option was chosen on the drop-down because of the
if ( 'alphabetical' == $orderby_value )
condition.This is mod which sorts in ascending alphabetical order by default, the differences being the condition
if ('alphabetical' == $orderby_value || 'menu_order' == $orderby_value)
and$args['order'] = 'ASC'
The site I was working on has grouped products so I made sure they were alphabetical as well…
woocommerce_clean()
is deprecated, usewc_clean()
instead.https://docs.woocommerce.com/wc-apidocs/function-woocommerce_clean.html