HUSKY - Products Filter Professional for WooCommerce

woof_order_catalog

woof_order_catalog

Позволяет изменить порядок сортировки каталога товаров при фильтрации. Возвращает массив с ключами orderby, order, meta_key.

Parameters

$catalog_data (array) — ['orderby' => string, 'order' => string, 'meta_key' => string]

Source File

index.php

Code Example

add_filter('woof_order_catalog', function($catalog_data) {
    // Force sorting by date descending for filtered results
    $catalog_data['orderby'] = 'date';
    $catalog_data['order'] = 'DESC';
    $catalog_data['meta_key'] = '';
    return $catalog_data;
});

Usage Notes

  • Add this code to your theme's functions.php file or a custom plugin.
  • The hook is applied during the filtering process — changes take effect immediately.
  • Always return the expected value type from the callback function.