Hello,
To make it redirect to a custom page as search results page:
Try to replace the line:
return home_url( '/' );
with:
return home_url( '/black-friday/' );
in the file:
wp-content/plugins/ymm-search/Block/Selector.php`
–
Then use a shortcode like this:
[products]
To display products on your custom wordpress page.
–
To make those products filtered by the current selected make, make and year:
Add the line:
add_filter( 'woocommerce_shortcode_products_query', array($this, 'filter_shortcode_products_query' ));
after the line:
add_filter('get_search_query', array($this, 'shop_order_search_label' ));
And add the code:
public function filter_shortcode_products_query($query_args) {
$values = $this->getSelectedValues();
$pIds = $this->getFoundProductIds();
if (count($values) > 0){
$query_args['post__in'] = count($pIds) > 0 ? $pIds : array(-1); // -1 to display a "no products found" message
}
return $query_args;
}
before the line:
public function applyFilter(){
in the file:
wp-content/plugins/ymm-search/Controller/Product.php
–
NOTE: You can add attributes to the products shortcode like “columns”, “orderby”:
https://woocommerce.com/document/woocommerce-shortcodes/#available-product-attributes
Stanislav