Tagged: sort options, woocommerce
-
AuthorPosts
-
November 23, 2021 at 12:50 pm #1330100
How can I customize the sort options on the shop page, category page and tag page?
Thanks, StephanNovember 24, 2021 at 6:23 am #1330255Hey Stephan_H,
Thank you for the inquiry.
Can you be more specific? What are you trying to change in the sort options?
The current sort options are created using the avia_woocommerce_frontend_search_params function in the themes/enfold/config-woocommerce/config.php around line 1503. You can manually edit the options from there.
You can also use a plugin to extend the default sorting option.
// https://wordpress.org/plugins/woocommerce-extra-product-sorting-options/
// https://wordpress.org/plugins/woocommerce-more-sorting/But you have to remove the custom sorting options that the theme added and re-enable the default sorting options from the shop plugin with these hooks.
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20 );
Best regards,
IsmaelNovember 24, 2021 at 10:48 am #1330274Hi Ismael,
Thanks for your reply. I want to remove some of the sort options that are not needed.
If I change the config file, will the changes be persistent? Would I have to copy that file into the child theme subdir?
And if I would like to remove the sort options altogether, would it be sufficient to use that remove_action hook?
Thanks, StephanNovember 25, 2021 at 8:48 am #1330417Hi,
Thank you for the update.
You cannot override the config file in the child theme, but you can copy the avia_woocommerce_frontend_search_params function in the child theme’s functions.php file and modify it as you please. And yes, you can use the remove_action function to completely disable or remove the custom sort options.
Best regards,
IsmaelNovember 25, 2021 at 12:03 pm #1330433Hi Ismael,
Thanks for your help and advise!
I chose to override the avia_woocommerce_frontend_search_params function in the child theme’s functions.php. This gives us the flexibility regarding sort options and their style of display we need.
Best Regards,
StephanNovember 26, 2021 at 7:51 am #1330549 -
AuthorPosts
- The topic ‘Customize WooCommerce sort options’ is closed to new replies.