WooCommerce REST API 在搜索中包含属性或自定义字段

WooCommerce REST API 在搜索中包含属性或自定义字段

问题描述:

我需要通过 REST API 提供的扩展搜索功能 - 主要是能够在搜索查询中包含产品的属性.

I need an extended search functionality available via REST API - mainly an ability to include product's attributes in a search query.

我看过很多类似的问题,但遗憾的是没有一个得到回答.这甚至可能吗?如果是这样,任何建议我可以如何或在哪里修改搜索查询以包含产品的属性?

I've seen a lot of similar questions but none of them are answered unfortunately. Is this even possible? And if so, any advice how or where I could modify the search query to include the product's attributes?

/wp-json/wc/v3/products - 列出所有产品

/wp-json/wc/v3/products - List all products

attribute - 将结果集限制为具有特定属性的产品:

attribute - Limit result set to products with a specific attribute:

示例:https://your-site.com/wp-json/wc/v3/products?consumer_key=ck_yourconsumerkey&consumer_secret=cs_yourconsumersecret&attribute=attr-name

attribute_term - 将结果集限制为具有特定属性术语 ID(需要分配的属性)的产品.

attribute_term - Limit result set to products with a specific attribute term ID (required an assigned attribute).

示例:https://your-site.com/wp-json/wc/v3/products?consumer_key=ck_yourconsumerkey&consumer_secret=cs_yourconsumersecret&attribute_term=2457

更多信息:https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products