Skip Navigation

[Resolved] Sorting by WooCommerce Featured Status

This support ticket is created 2 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 2 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#2210035

I would like to have my products archive show products marked as being featured first, and then alphabetically as a secondary sort. However, I don't see the WooCommerce featured option listed under the possible fields to sort on. Can you assist? The ability to mark a product featured is built-in with WooCommerce so I'm hoping this field can be used as a sort. Thanks.

- Aaron

#2210091

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting Toolset support.

WooCommerce featured products are handled through a hidden custom taxonomy "product_visibility" instead of a custom field. Toolset views are just a wrapper around the WP_Query class from WordPress. WordPress does not offer a supported way of ordering with a custom taxonomy. However, it can be achievable through some custom code. Check these pages:
- https://stackoverflow.com/questions/46246614/get-woocommerce-featured-products-in-a-wp-query
- https://stackoverflow.com/questions/60494185/promote-featured-products-to-top-of-category-in-woocommerce
- https://stackoverflow.com/questions/50278914/woocommerce-display-featured-products-at-top-of-category-page
- hidden link

This being said, the easiest way, I can imagine, to achieve what you want is using a custom field. Create a select or radio field for the products, and add two possible options(Featured/Not featured) with the respective values(1/0). And "Not featured(0)" is the default option. Then manually make update this field on the products. That way, you can choose this field in the primary order, and choose the product's title.
You may create a custom code that can mirror this for you upon product saving https://developer.wordpress.org/reference/hooks/save_post/

Or, you may just display the featured products using a shortcode above the archive loop, and let them appear in the loop too. They may be duplicated by the page, but that would be the easy solution.
https://docs.woocommerce.com/document/woocommerce-shortcodes/#section-9

I hope this answers your question. Let me know if you have any further questions.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.