Hello, st7878,
We have noticed that you are currently using an outdated version of the theme (9.4.7). We kindly ask you to update it to the latest version (9.6.5) to ensure optimal performance and compatibility.
Best regards,
8Theme Team
Solved8 replies4 participantsUpdated by Tony Rodriguez
Hello. In the Searched Products widget for Elementor that you developed, there is no product sorting option in the settings. Therefore, out-of-stock products may be displayed among other products. It would be good to generally implement a “Do not show out-of-stock products” button in the settings. But at the moment, I am interested in how to make out-of-stock products appear at the very bottom (last)?
Hello, st7878,
We have noticed that you are currently using an outdated version of the theme (9.4.7). We kindly ask you to update it to the latest version (9.6.5) to ensure optimal performance and compatibility.
Best regards,
8Theme Team
The theme version has no relation to the sorting of products in the search results generated by your widget for Elementor. I am working with the latest version on a local server. Once again, my question: how can I make out-of-stock products appear at the very bottom in the search results?
Hi,
The option you are asking about is not available by default, so you may submit a request for its addition on our Taskboard at https://www.8theme.com/taskboard/. If your idea garners sufficient support from other customers, our development team will carefully evaluate the possibility of including it in a future update.
In the meantime, you can try using the “Hide out of stock items from the catalog” feature, which can be found in your WooCommerce settings (WooCommerce → Settings → Products → Inventory). As a result, any products that are out of stock will be automatically excluded from search results.
Best regards,
8Theme Team
It seems strange to me to ask for snow in winter. After all, logically, from a marketing perspective, there’s no point in showing out-of-stock products at the beginning. But I’ll think about your suggestion to contact the development team with a proposal that “the credits should be at the end of the film, not in the middle.” Since you can’t help me, then please tell me which hooks for sorting this widget uses. I’ll write the sorting code for it myself. Thank you.
Hi,
Thank you for your message and for sharing your thoughts and suggestions.
Regarding your request, the widget uses standard WooCommerce sorting hooks. You can refer to the following hooks for customization:
– woocommerce_get_catalog_ordering_args
– woocommerce_catalog_orderby
– woocommerce_default_catalog_orderby_options
Additionally, please read these replies – https://www.8theme.com/search/?bbp_search=woocommerce_get_catalog_ordering_args&bbp_forum_id=128990
Warm Regards,
The 8Theme Team
Here’s a working solution that solves my problem. Might be useful to someone.
add_filter( 'woocommerce_products_widget_query_args', 'custom_sort_products_widget_by_stock' );
function custom_sort_products_widget_by_stock( $query_args ) {
if ( isset( $query_args['s'] ) ) {
$meta_query = $query_args['meta_query'] ?? array();
$meta_query[] = array(
'relation' => 'OR',
array(
'key' => '_stock_status',
'value' => 'instock',
'compare' => '=',
),
array(
'key' => '_stock_status',
'value' => 'outofstock',
'compare' => '=',
),
);
$query_args['meta_query'] = $meta_query;
$query_args['meta_key'] = '_stock_status';
$query_args['orderby'] = 'meta_value ASC';
$query_args['order'] = 'ASC';
}
return $query_args;
}
Thanks for the support! My topic “How to edit the sort order in the search results of the Searched Products widget for Elementor” has been successfully resolved.
Dear st7878,
It’s great having you in our WordPress & WooCommerce community!
Every insight you share helps us refine XStore and build tools that empower thousands of online store owners worldwide.
Leave Feedback →
(takes less than a minute)
Together, we grow stronger with every release.
Topic closed.
The 8Theme Team
The issue related to '‘How to edit the sort order in the search results of the Searched Products widget for Elementor’' has been successfully resolved, and the topic is now closed for further responses
Free AI store scan · SalesMax
Paste your store address. SalesMax AI shows which upsell moments are missing. No signup.
Free AI speed test · FlashMax
Paste your site address. FlashMax runs Google Lighthouse for phone and desktop, checks Core Web Vitals and lists what to fix. No signup.
Organic Store 01Food & drinks
(live demo, opens in a new tab)
SEO AgencyBusiness
(live demo, opens in a new tab)
FishingSports & travel
(live demo, opens in a new tab)
Classic Fashion StoreFashion
(live demo, opens in a new tab)
Games DarkToys & games
(live demo, opens in a new tab)
Beauty & CosmeticsBeauty
(live demo, opens in a new tab)
Home Decor 02 StoreFurniture
(live demo, opens in a new tab)
Eco Scooter StoreSports & travel
(live demo, opens in a new tab)
Rental CarCars & bikes
(live demo, opens in a new tab)
Concert StoreBooks & art
(live demo, opens in a new tab)
Pizza StoreFood & drinks
(live demo, opens in a new tab)
X-Phone StoreElectronics
(live demo, opens in a new tab)
Plumbing StoreFurniture
(live demo, opens in a new tab)
Artmaxy StoreBooks & art
(live demo, opens in a new tab)
Minimal Fashion StoreFashion
(live demo, opens in a new tab)
Online CoursesBusiness
(live demo, opens in a new tab)