File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed
Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ # Product custom fields #
2+
3+ The product custom fields API allows you to view the custom fields that have been recorded.
4+
5+ ## Product custom fields properties ##
6+
7+ | Attribute | Type | Description |
8+ | --------- | ------ | ----------------------------------------------------------------------------------------------------------- |
9+ | ` key ` | string | The custom field key. |
10+ | ` value ` | string | The value set for the key. |
11+
12+ ## Retrieve product custom fields ##
13+
14+ This API lets you retrieve filtered custom fields.
15+
16+ <div class =" api-endpoint " >
17+ <div class="endpoint-data">
18+ <i class="label label-get">GET</i>
19+ <h6>/wp-json//wc/v3/products/custom-fields/names</h6>
20+ </div>
21+ </div >
22+
23+ ``` shell
24+ curl https://example.com/wp-json/wc/v3/products/custom-fields/names \
25+ -u consumer_key:consumer_secret
26+ ```
27+
28+ ``` javascript
29+ WooCommerce .get (" products/custom-fields/names" )
30+ .then ((response ) => {
31+ console .log (response .data );
32+ })
33+ .catch ((error ) => {
34+ console .log (error .response .data );
35+ });
36+ ```
37+
38+ ``` php
39+ <?php print_r($woocommerce->get('products/custom-fields/names')); ?>
40+ ```
41+
42+ ``` python
43+ print (wcapi.get(" products/custom-fields/names" ).json())
44+ ```
45+
46+ ``` ruby
47+ woocommerce.get(" products/custom-fields/names" ).parsed_response
48+ ```
49+
50+ > JSON response example:
51+
52+ ``` json
53+ {
54+ [
55+ " Custom field 1" ,
56+ " Custom field 2" ,
57+ " Custom field 3" ,
58+ " Custom field 4"
59+ ]
60+ }
61+ ```
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ includes:
3131 - wp-api-v3/product-attributes
3232 - wp-api-v3/product-attribute-terms
3333 - wp-api-v3/product-categories
34+ - wp-api-v3/product-custom-fields
3435 - wp-api-v3/product-shipping-classes
3536 - wp-api-v3/product-tags
3637 - wp-api-v3/product-reviews
You can’t perform that action at this time.
0 commit comments