Is it possible to access custom fields for orders, products, customers via WooCommerce REST API? If not natively, then what plugins or workarounds or hacks are out there that work? Thanks!
相关问题
- Design RESTful service with multiple ids
- Display product ACF field value in Woocommerce tra
- Axios OPTIONS instead of POST Request. Express Res
- Plain (non-HTML) error pages in REST api
- Adding a custom button after add to cart button in
相关文章
- 我用scrapy写了一个蛮简单的爬虫怎么封装成一个api啊
- 后端给前端的API接口是怎么用代码写的
- Convert C# Object to Json Object
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Android camera2 API get focus distance in AF mode
- Got ActiveRecord::AssociationTypeMismatch on model
- Multiple parameters in AngularJS $resource GET
Answering my own question:
It is possible using the following: (using v3 legacy API)
To send custom fields back to the server: (For Orders)
To retrieve custom fields from server use this filter with your end point:
This works for Products as well.
As mentioned in the comment after WooCommerce creates an order via the API it will fire
woocommerce_api_create_order
hook, you can make use of it.Add the following code to your theme's functions.php file
Similarly look at the code in
plugins/woocommerce/includes/api/*.php
files, find the suitable action or filter hook for the end point and use it.