File tree 3 files changed +43
-6
lines changed
3 files changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,36 @@ $product = [
39
39
That's it. Make sure those elements are in your REST API request, and this plugin is installed at the other end,
40
40
and you can set any meta fields you like, except for the protected fields (see below).
41
41
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
+
42
72
I have not tested this with anything other than strings, so be aware that the behaviour storing other data structures
43
73
in metafields are * undefined* at present.
44
74
Original file line number Diff line number Diff line change 1
1
=== WC API Custom Meta ===
2
2
Contributors: judgej
3
- Tags: woocommerce,
3
+ Tags: woocommerce, api
4
4
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=B4STZL8F5WHK6
5
5
Requires 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
8
8
License: GPL2
9
9
License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
10
10
11
11
Allows access to custom meta fields on products through the API.
12
12
13
13
== Description ==
14
14
Allows 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
15
20
16
21
== Installation ==
17
22
Standard installation - whatever you normally do.
18
23
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 3
3
Plugin Name: WC API Custom Meta
4
4
Plugin URI: hhttps://github.com/judgej/wc-api-custom-meta
5
5
Description: Allows access to custom meta fields on products through the API.
6
- Version: 0.6 .0
6
+ Version: 0.7 .0
7
7
Author: Jason Judge
8
- Author URI: http://academe.co.uk
8
+ Author URI: http://academe.co.uk https://github.com/buxit
9
9
*/
10
10
11
11
/**
You can’t perform that action at this time.
0 commit comments