Meathanjay
Meathanjay

Reputation: 2073

Woocommerce product search from certain category

How can search product from a category by search string and others attribute?

Example:

In movie category, I have 20 product, I want to search for movie category by search string (?s='action' parameter), and others attribute like movie_type=thiller

Upvotes: 1

Views: 416

Answers (1)

slbteam08
slbteam08

Reputation: 681

Parameters accepted by Wordpress search string are listed here: https://developer.wordpress.org/reference/classes/wp_query/parse_query/

For attribute / custom fields, meta_key and meta_value may be used. So the query in your example should be like

http://yoursite.com/?s=action&category_name=movie&meta_key=movie_type&meta_value=thriller

Upvotes: 1

Related Questions