From 210a6856303bf9c6e8a1589bba1a663c8b549122 Mon Sep 17 00:00:00 2001 From: Patski123 Date: Sun, 3 May 2026 14:22:46 +0000 Subject: [PATCH] Fix WC10: replace removed wc_get_catalog_ordering_args() with woocommerce_catalog_orderby filter --- theme/woocommerce/archive-product.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/theme/woocommerce/archive-product.php b/theme/woocommerce/archive-product.php index 140b9e2..242acfb 100644 --- a/theme/woocommerce/archive-product.php +++ b/theme/woocommerce/archive-product.php @@ -85,7 +85,15 @@ $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'me
$opt) { + $ordering_options = apply_filters('woocommerce_catalog_orderby', [ + 'menu_order' => __('Default sorting', 'woocommerce'), + 'popularity' => __('Sort by popularity', 'woocommerce'), + 'rating' => __('Sort by average rating', 'woocommerce'), + 'date' => __('Sort by latest', 'woocommerce'), + 'price' => __('Sort by price: low to high', 'woocommerce'), + 'price-desc' => __('Sort by price: high to low', 'woocommerce'), + ]); + foreach ($ordering_options as $val => $opt) { $current = (isset($_GET['orderby']) ? $_GET['orderby'] : get_option('woocommerce_default_catalog_orderby')) === $val; $url = add_query_arg('orderby', $val); echo '' . esc_html($opt) . '';