[英]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 在电影类别中,我有20种产品,我想通过搜索字符串(?s ='action'参数)以及其他属性(例如movie_type = thiller)来搜索电影类别
Parameters accepted by Wordpress search string are listed here: https://developer.wordpress.org/reference/classes/wp_query/parse_query/ 此处列出了Wordpress搜索字符串接受的参数: https : //developer.wordpress.org/reference/classes/wp_query/parse_query/
For attribute / custom fields, meta_key
and meta_value
may be used. 对于属性/自定义字段,可以使用meta_key
和meta_value
。 So the query in your example should be like 因此,您的示例中的查询应类似于
http://yoursite.com/?s=action&category_name=movie&meta_key=movie_type&meta_value=thriller
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.