File tree Expand file tree Collapse file tree 3 files changed +43
-6
lines changed Expand file tree Collapse file tree 3 files changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,36 @@ $product = [
3939That's it. Make sure those elements are in your REST API request, and this plugin is installed at the other end,
4040and you can set any meta fields you like, except for the protected fields (see below).
4141
42+ From version 0.7.0 metadata on variations is also supported:
43+
44+ ~~~ php
45+ $product = [
46+ 'product' => [
47+ 'title' => 'Foobar',
48+ ...
49+ 'variations' => [
50+ [
51+ 'regular_price' => '9.50',
52+ 'attributes' => [
53+ [
54+ 'name' => 'Pack Size',
55+ 'slug' => 'pack-size',
56+ 'option' => '4-pack etc',
57+ ],
58+ // These custom meta fields will be added to the variations.
59+ // When fetching variable products, the metafields will be retrieved
60+ // for the variations.
61+ 'custom_meta' => [
62+ 'my_custom_variation_field_name' => 'my custom variation value',
63+ 'my_other_variation_custom_field_name' => 'my other custom variation value',
64+ ],
65+ ],
66+ ],
67+ ],
68+ ]
69+ ]
70+ ~~~
71+
4272I have not tested this with anything other than strings, so be aware that the behaviour storing other data structures
4373in metafields are * undefined* at present.
4474
Original file line number Diff line number Diff line change 11=== WC API Custom Meta ===
22Contributors: judgej
3- Tags: woocommerce,
3+ Tags: woocommerce, api
44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=B4STZL8F5WHK6
55Requires at least: 4.0.0
6- Tested up to: 4.2 .2
7- Stable tag: 0.6 .0
6+ Tested up to: 4.4 .2
7+ Stable tag: 0.7 .0
88License: GPL2
99License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
1010
1111Allows access to custom meta fields on products through the API.
1212
1313== Description ==
1414Allows access to custom meta fields on products through the API.
15+ In short, installing this plugin on your WooCommerce site, will extend the
16+ WooCommerce API so that custom metadata can be passed back and forth through
17+ that API.
18+
19+ See the main documentation here: https://github.com/judgej/wc-api-custom-meta
1520
1621== Installation ==
1722Standard installation - whatever you normally do.
1823
19- Will only work with WooCommerce with the V2 API.
24+ Will only work with WooCommerce with the V2 API at his time, which means any version
25+ from mid-2015, until the V2 API is eventually removed. It may work with the V3
26+ API, but that has not been tested.
Original file line number Diff line number Diff line change 33Plugin Name: WC API Custom Meta
44Plugin URI: hhttps://github.com/judgej/wc-api-custom-meta
55Description: Allows access to custom meta fields on products through the API.
6- Version: 0.6 .0
6+ Version: 0.7 .0
77Author: Jason Judge
8- Author URI: http://academe.co.uk
8+ Author URI: http://academe.co.uk https://github.com/buxit
99*/
1010
1111/**
You can’t perform that action at this time.
0 commit comments