惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
L
LangChain Blog
GbyAI
GbyAI
F
Fortinet All Blogs
腾讯CDC
Last Week in AI
Last Week in AI
A
About on SuperTechFans
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
B
Blog
D
Docker
G
Google Developers Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
U
Unit 42
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed

博客园 - 狼人:-)

KMS 激活服务,slmgr 命令激活 Windows 系统、Office 老大爷都在养龙虾了!小白3分钟本地装 OpenClaw + 飞书打通全攻略(零基础必看) OpenClaw 飞书频道配置指南 vmware嵌套安装esxi7.0.3扩容vmfs Github 学生认证保姆级教程 WordPress 前端显示英文,后台显示中文的设置 Linux 系统备份恢复工具 SYSTEM-RESCUE-CD 的使用sysrcd Cloudflare中的“托管质询”、“JavaScript质询“、”交互式质询”区别 如何使用FlareSolverr来抓取Cloudflare网站 绕过TLS:akamai指纹护盾 bagisto nginx配置 Bagisto电商系统在生产环境解决http未转https错误 win10的大BUG,C盘显示剩余容量2G,原来是hiberfil.sys文件引起的 Windows Server 2022英文版改中文版后,Asp.net的时区与系统设置的时区不一致,设置如下 CentOS7 磁盘挂载操作 Python3安装gevent报gcc错误 转载 Python 关于requests 关闭连接,优化内存 The Paste(Wordpress编辑器粘贴即上传插件) Wordpress安装Elementor后无法使用,需安装插件:Flexible SSL for CloudFlare(解决https循环重定向) Wifi密码获取
wordpress woocommerce api 设置product_brand
狼人:-) · 2025-03-18 · via 博客园 - 狼人:-)

2025-03-18 21:56  狼人:-)  阅读(79)  评论()    收藏  举报

https://woocommerce.com/document/managing-product-taxonomies/product-brands/

Brands REST API

The Brands REST API allows you to create, view, update, and delete individual, or a batch, of brands. The endpoint is /wp-json/wc/v1/products/brands which basically mimics /wp-json/wc/v1/products/categories. You can refer to the same documentation of product categories REST API.

In addition to /products/brands endpoints, the /products endpoints also updated to display brands in the response and check the JSON request for brands.

Examples

  • Retrieve all product brands:

    curl https://example.com/wp-json/wc/v2/products/brands -u consumer_key:consumer_secret
    
  • Create a product brand:

    curl -X POST https://example.com/wp-json/wc/v2/products/brands \
     -u consumer_key:consumer_secret \
     -H "Content-Type: application/json" \
     -d '{
     "name": "Apple",
     "image": {
       "src": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/768px-Apple_logo_black.svg.png"
      }
    }'
    
  • Delete a product brand:

    curl -X DELETE https://example.com/wp-json/wc/v2/products/brands/9?force=true -u consumer_key:consumer_secret
    
  • Set brands to a product:

     curl -X PUT https://example.com/wp-json/wc/v2/products/123 \
      -u consumer_key:consumer_secret \
      -H 'Content-Type: application/json' \
      -d '{"brands": [48, 49]}'
    

    Note: When setting a brand to a product the url needs to be products/123 where 123 is the id of the product you want to update.