I am trying to: pass a search parameter using url parameters to display a set of matching products
Link to a page where the issue can be seen: hidden link
I expected to see: the results on the page hidden link filtered based on the url parameters
Instead, I got: products that are not in the category of the value in the url parameter display and other filters are not working as well
see enclosed filter for the view settings.
you can test on the test page: hidden link to see available products and see the possible alternatives in the url search parameter but when you look into the product taxonomy value against the filter there is no match.
repro steps on the test page
select gender = female
click search - search results render hidden link
click the first product on the lest "Cypress DX test name"
the product page render - hidden link
click the Spec tab
you can see that the gender is set to male and not female.
the same goes for age group.
the URL parmeters i'm working with are:
pr - price - set by woocommerce product price
bt - bike type - set by woocommerce product category
ag - age group - woocommerce taxonomy set up with toolset
gn - gender - woocommerce taxonomy set up with toolsett
yr - year - woocommerce taxonomy set up with toolset
I just pinpoint the issue.
In short, I created a new view on my stage environment and worked step be step to test it. it all worked fine and as intended until I set the view "Ordering" to a custom field "order by = Field - Bike Score" AND use the following code to display only simple products on the page.
if the order by is set to "Post Date" the URL parameters works just fine with the code above. the minute I set it to the custom filed "order by = Field - Bike Score" the query string is been ignored.
the code above is located under snippets under the name "Get Product Type".
The custom code you added to modify that View was written at a time when you weren't adding other taxonomy filters.
Now that you have the current code replaces the taxonomy query generated by the filters, instead of being appended to it.
You can fix that with a minor tweak to the custom code, by editing this line so that it includes empty square brackets (so that the array element is appended to existing elements):
Thanks Nigel,
Your solution solved the issue and things are working as they intended t.
I highly appreciate your help with this.
Have a great weekend,
David