HUSKY - Product Filter for WooCommerce

woof_order_catalog

From v.2.2.4/1.2.4

Adds a custom sort order for the catalog.

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.