使用 woocommerce API 在产品中添加属性

Add attributs in Product using woocommrece API

当我从 API woocommerce 创建产品属性时,该属性没有出现在我网站 wordpress 的页面上,所以我必须手动刷新产品的发布请帮忙?

enter image description here

enter image description here

  1. 首先,如果您已经在属性部分创建了属性 Woocommerce.You 可以通过此 PUT 更新:- http:/example.com/wp-json/wc/v3/products/123 BODY:

    { “属性”: [ { "id": 4, //例子:颜色的ID “选项”:“白色” } ] }

  2. 如果属性部分不存在属性,请创建属性并分配给 products.You 可以通过这种方式创建属性。 POST:- /wp-json/wc/v3/products/attributes

    BODY:

    { "名称": "颜色", "slug": "pa_color", “类型”:“select”, "order_by": "menu_order", “has_archives”:真 }