PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

AJAX Sort Products by Custom Sorting Method (Title - Z to A)

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi,
I have a custom sorting method set for more store (that works fine), however - This plugin takes over the sorting and will not AJAX sort this new method (Title - Z to A)
- Other included sorting methods work fine (in AJAX) including: Title - A to Z, Sort by Newest

Is there anything I can do to get this plugin / AJAX working with sort from title Z - A?
- Please see attached Private Frontend URL of staging website (Archive page with 2 test products that can be sorted)

Cheers

Hello

If your custom"Title - Z to A" sorting doesn't work with AJAX, maybe it's not registered correctly with WooCommerce.

Please make sure your custom sorting uses standard WooCommerce filters:

add_filter('woocommerce_catalog_orderby', function($sortby) {
$sortby['title_desc'] = __('Title - Z to A', 'woocommerce');
return $sortby;
});

add_filter('woocommerce_get_catalog_ordering_args', function($args) {
if (isset($_GET['orderby']) && $_GET['orderby'] == 'title_desc') {
$args['orderby'] = 'title';
$args['order'] = 'DESC';
}
return $args;
});

Replace 'title_desc' with your actual sorting key.

p.s. https://share.pluginus.net/image/i20230222134615.png - share please also purchase code in the private area for this site