I'm trying to use the shop page to display custom search results in woocommerce after a form submit.
So the scenario is:
- Someone, via a form, chooses ex: a product type.
- The page redirects to a separate php page to handle the result, hook into the query and redirect to shop page.
This is what my separate php page looks like:
if (isset('submit')){
add_action('pre_get_posts', function($query){
//my hook that doesn't work
});
wp_redirect( get_permalink( wc_get_page_id( 'shop' ) ) );
exit;
}
The result is my shop page with all items. How can I hook into the shop to display a specific query of my own?