WooCommerce REST API 在搜索中包含属性或自定义字段 [英] WooCommerce REST API include attributes or custom fields in search

查看:38
本文介绍了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

这篇关于WooCommerce REST API 在搜索中包含属性或自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆