Divi Product Filter: Using HUSKY with Divi
HUSKY works with Divi shops. Insert the filter with the [woof] shortcode in a Divi Code or Text module, or keep it in the sidebar as a widget.
The Divi Shop module renders products through its own template, so connect it to the filter with this code in the child theme functions.php:
//Make the Husky product filter work with page builder layouts
add_action('pre_get_posts', function ($query) {
if (is_object($query) AND isset($query->query['post_type'])) {
if ($query->query['post_type'] === 'product' /* AND is_page(1867) */) {
if (isset($query->query['wc_query']) AND 'product_query' == $query->query['wc_query']) {
return $query;
}
global $WOOF;
if (is_object($WOOF) AND !empty(woof()->get_request_data())) {
woof()->woof_products_ids_prediction(['per_page'=>99999]);
$query->query_vars['post__in'] = $_REQUEST['woof_wp_query_ids'];
}
}
}
return $query;
});
Uncomment is_page(1867) and set your own page ID to limit the filtering to one page.