70 |
71 | <%= image_tag "logo.png" %>
72 |
73 | <% if language_tabs.any? %>
74 |
83 | <% end %>
84 | <% if current_page.data.search %>
85 |
86 |
87 |
88 |
89 | <% end %>
90 |
91 | <% toc_data(page_content).each do |h1| %>
92 | -
93 | <%= h1[:content] %>
94 | <% if h1[:children].length > 0 %>
95 |
102 | <% end %>
103 |
104 | <% end %>
105 |
106 | <% if current_page.data.toc_footers %>
107 |
112 | <% end %>
113 |
114 |
115 |
116 |
117 | <%= page_content %>
118 |
119 |
120 | <% if language_tabs.any? %>
121 |
122 | <% language_tabs.each do |lang| %>
123 | <% if lang.is_a? Hash %>
124 |
<%= lang.values.first %>
125 | <% else %>
126 |
<%= lang %>
127 | <% end %>
128 | <% end %>
129 |
130 | <% end %>
131 |
132 |
133 |
134 | <% if current_page.data.warning %>
135 | ]
7 | Deploy generated files to a git branch.
8 |
9 | Options:
10 |
11 | -h, --help Show this help information.
12 | -v, --verbose Increase verbosity. Useful for debugging.
13 | -e, --allow-empty Allow deployment of an empty directory.
14 | -m, --message MESSAGE Specify the message used when committing on the
15 | deploy branch.
16 | -n, --no-hash Don't append the source commit's hash to the deploy
17 | commit's message.
18 | "
19 |
20 | parse_args() {
21 | # Set args from a local environment file.
22 | if [ -e ".env" ]; then
23 | source .env
24 | fi
25 |
26 | # Parse arg flags
27 | # If something is exposed as an environment variable, set/overwrite it
28 | # here. Otherwise, set/overwrite the internal variable instead.
29 | while : ; do
30 | if [[ $1 = "-h" || $1 = "--help" ]]; then
31 | echo "$help_message"
32 | return 0
33 | elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
34 | verbose=true
35 | shift
36 | elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
37 | allow_empty=true
38 | shift
39 | elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
40 | commit_message=$2
41 | shift 2
42 | elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
43 | GIT_DEPLOY_APPEND_HASH=false
44 | shift
45 | else
46 | break
47 | fi
48 | done
49 |
50 | # Set internal option vars from the environment and arg flags. All internal
51 | # vars should be declared here, with sane defaults if applicable.
52 |
53 | # Source directory & target branch.
54 | deploy_directory=build
55 | deploy_branch=gh-pages
56 |
57 | #if no user identity is already set in the current git environment, use this:
58 | default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
59 | default_email=${GIT_DEPLOY_EMAIL:-}
60 |
61 | #repository to deploy to. must be readable and writable.
62 | repo=origin
63 |
64 | #append commit hash to the end of message by default
65 | append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
66 | }
67 |
68 | main() {
69 | parse_args "$@"
70 |
71 | enable_expanded_output
72 |
73 | if ! git diff --exit-code --quiet --cached; then
74 | echo Aborting due to uncommitted changes in the index >&2
75 | return 1
76 | fi
77 |
78 | commit_title=`git log -n 1 --format="%s" HEAD`
79 | commit_hash=` git log -n 1 --format="%H" HEAD`
80 |
81 | #default commit message uses last title if a custom one is not supplied
82 | if [[ -z $commit_message ]]; then
83 | commit_message="publish: $commit_title"
84 | fi
85 |
86 | #append hash to commit message unless no hash flag was found
87 | if [ $append_hash = true ]; then
88 | commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
89 | fi
90 |
91 | previous_branch=`git rev-parse --abbrev-ref HEAD`
92 |
93 | if [ ! -d "$deploy_directory" ]; then
94 | echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
95 | return 1
96 | fi
97 |
98 | # must use short form of flag in ls for compatibility with macOS and BSD
99 | if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
100 | echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
101 | return 1
102 | fi
103 |
104 | if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
105 | # deploy_branch exists in $repo; make sure we have the latest version
106 |
107 | disable_expanded_output
108 | git fetch --force $repo $deploy_branch:$deploy_branch
109 | enable_expanded_output
110 | fi
111 |
112 | # check if deploy_branch exists locally
113 | if git show-ref --verify --quiet "refs/heads/$deploy_branch"
114 | then incremental_deploy
115 | else initial_deploy
116 | fi
117 |
118 | restore_head
119 | }
120 |
121 | initial_deploy() {
122 | git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
123 | git --work-tree "$deploy_directory" add --all
124 | commit+push
125 | }
126 |
127 | incremental_deploy() {
128 | #make deploy_branch the current branch
129 | git symbolic-ref HEAD refs/heads/$deploy_branch
130 | #put the previously committed contents of deploy_branch into the index
131 | git --work-tree "$deploy_directory" reset --mixed --quiet
132 | git --work-tree "$deploy_directory" add --all
133 |
134 | set +o errexit
135 | diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
136 | set -o errexit
137 | case $diff in
138 | 0) echo No changes to files in $deploy_directory. Skipping commit.;;
139 | 1) commit+push;;
140 | *)
141 | echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2
142 | return $diff
143 | ;;
144 | esac
145 | }
146 |
147 | commit+push() {
148 | set_user_id
149 | git --work-tree "$deploy_directory" commit -m "$commit_message"
150 |
151 | disable_expanded_output
152 | #--quiet is important here to avoid outputting the repo URL, which may contain a secret token
153 | git push --quiet $repo $deploy_branch
154 | enable_expanded_output
155 | }
156 |
157 | #echo expanded commands as they are executed (for debugging)
158 | enable_expanded_output() {
159 | if [ $verbose ]; then
160 | set -o xtrace
161 | set +o verbose
162 | fi
163 | }
164 |
165 | #this is used to avoid outputting the repo URL, which may contain a secret token
166 | disable_expanded_output() {
167 | if [ $verbose ]; then
168 | set +o xtrace
169 | set -o verbose
170 | fi
171 | }
172 |
173 | set_user_id() {
174 | if [[ -z `git config user.name` ]]; then
175 | git config user.name "$default_username"
176 | fi
177 | if [[ -z `git config user.email` ]]; then
178 | git config user.email "$default_email"
179 | fi
180 | }
181 |
182 | restore_head() {
183 | if [[ $previous_branch = "HEAD" ]]; then
184 | #we weren't on any branch before, so just set HEAD back to the commit it was on
185 | git update-ref --no-deref HEAD $commit_hash $deploy_branch
186 | else
187 | git symbolic-ref HEAD refs/heads/$previous_branch
188 | fi
189 |
190 | git reset --mixed
191 | }
192 |
193 | filter() {
194 | sed -e "s|$repo|\$repo|g"
195 | }
196 |
197 | sanitize() {
198 | "$@" 2> >(filter 1>&2) | filter
199 | }
200 |
201 | main "$@"
202 |
--------------------------------------------------------------------------------
/source/javascripts/lib/_imagesloaded.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * imagesLoaded PACKAGED v3.1.8
3 | * JavaScript is all like "You images are done yet or what?"
4 | * MIT License
5 | */
6 |
7 | (function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
--------------------------------------------------------------------------------
/source/includes/v2/_reports.md:
--------------------------------------------------------------------------------
1 | # Reports #
2 |
3 | This section lists all API that can be used view reports.
4 |
5 | ## Reports Filters ##
6 |
7 | Use the following filters for any type of report to specify the period of sales:
8 |
9 | | Filter | Type | Description |
10 | | ---------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11 | | `period` | string | The supported periods are: `week`, `month`, `last_month`, and `year`. If you use an invalid period, `week` is used. If you don't specify a period, the current day is used |
12 | | `date_min` | string | Return sales for a specific start date. The date need to be in the `YYYY-MM-DD` format |
13 | | `date_max` | string | Return sales for a specific end date. The dates need to be in the `YYYY-MM-DD` format. Required to set the `filter[date_min]` too |
14 |
15 | ## View List Of Reports ##
16 |
17 | This API lets you retrieve and view a simple list of available reports.
18 |
19 | ### HTTP Request ###
20 |
21 |
22 |
23 | GET
24 |
/wc-api/v2/reports
25 |
26 |
27 |
28 | ```shell
29 | curl https://example.com/wc-api/v2/reports \
30 | -u consumer_key:consumer_secret
31 | ```
32 |
33 | ```javascript
34 | WooCommerce.get('reports', function(err, data, res) {
35 | console.log(res);
36 | });
37 | ```
38 |
39 | ```python
40 | print(wcapi.get("reports").json())
41 | ```
42 |
43 | ```php
44 | reports->get()); ?>
45 | ```
46 |
47 | ```ruby
48 | woocommerce.get("reports").parsed_response
49 | ```
50 |
51 | > JSON response example:
52 |
53 | ```json
54 | {
55 | "reports": [
56 | "sales",
57 | "sales/top_sellers"
58 | ]
59 | }
60 | ```
61 |
62 | ## View List Of Sales Report ##
63 |
64 | This API lets you retrieve and view a list of sales report.
65 |
66 | ### HTTP Request ###
67 |
68 |
69 |
70 | GET
71 |
/wc-api/v2/reports/sales
72 |
73 |
74 |
75 | ```shell
76 | curl https://example.com/wc-api/v2/reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21 \
77 | -u consumer_key:consumer_secret
78 | ```
79 |
80 | ```javascript
81 | WooCommerce.get('reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21', function(err, data, res) {
82 | console.log(res);
83 | });
84 | ```
85 |
86 | ```python
87 | print(wcapi.get("reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21").json())
88 | ```
89 |
90 | ```php
91 | array(
94 | 'date_min' => '2015-01-18',
95 | 'date_max' => '2015-01-21'
96 | )
97 | );
98 |
99 | print_r($woocommerce->reports->get_sales($args));
100 | ?>
101 | ```
102 |
103 | ```ruby
104 | woocommerce.get("reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21").parsed_response
105 | ```
106 |
107 | > JSON response example:
108 |
109 | ```json
110 | {
111 | "sales": {
112 | "total_sales": "580.10",
113 | "average_sales": "145.03",
114 | "total_orders": 4,
115 | "total_items": 31,
116 | "total_tax": "26.10",
117 | "total_shipping": "20.00",
118 | "total_discount": "0.00",
119 | "totals_grouped_by": "day",
120 | "totals": {
121 | "2015-01-18": {
122 | "sales": "-17.00",
123 | "orders": 1,
124 | "items": 1,
125 | "tax": "0.00",
126 | "shipping": "0.00",
127 | "discount": "0.00",
128 | "customers": 0
129 | },
130 | "2015-01-19": {
131 | "sales": "0.00",
132 | "orders": 0,
133 | "items": 0,
134 | "tax": "0.00",
135 | "shipping": "0.00",
136 | "discount": "0.00",
137 | "customers": 0
138 | },
139 | "2015-01-20": {
140 | "sales": "0.00",
141 | "orders": 0,
142 | "items": 0,
143 | "tax": "0.00",
144 | "shipping": "0.00",
145 | "discount": "0.00",
146 | "customers": 0
147 | },
148 | "2015-01-21": {
149 | "sales": "597.10",
150 | "orders": 3,
151 | "items": 30,
152 | "tax": "26.10",
153 | "shipping": "20.00",
154 | "discount": "0.00",
155 | "customers": 0
156 | }
157 | },
158 | "total_customers": 0
159 | }
160 | }
161 | ```
162 |
163 | ## View List Of Top Sellers Report ##
164 |
165 | This API lets you retrieve and view a list of top sellers report.
166 |
167 | ### HTTP Request ###
168 |
169 |
170 |
171 | GET
172 |
/wc-api/v2/reports/sales/top_sellers
173 |
174 |
175 |
176 | ```shell
177 | curl https://example.com/wc-api/v2/reports/sales/top_sellers?filter[period]=last_month \
178 | -u consumer_key:consumer_secret
179 | ```
180 |
181 | ```javascript
182 | WooCommerce.get('reports/sales/top_sellers?filter[period]=last_month', function(err, data, res) {
183 | console.log(res);
184 | });
185 | ```
186 |
187 | ```python
188 | print(wcapi.get("reports/sales/top_sellers?filter[period]=last_month").json())
189 | ```
190 |
191 | ```php
192 | array(
195 | 'period' => 'last_month'
196 | )
197 | );
198 |
199 | print_r($woocommerce->reports->get_top_sellers($args));
200 | ?>
201 | ```
202 |
203 | ```ruby
204 | woocommerce.get("reports/sales/top_sellers?filter[period]=last_month").parsed_response
205 | ```
206 |
207 | > JSON response example:
208 |
209 | ```json
210 | {
211 | "top_sellers": [
212 | {
213 | "title": "Happy Ninja",
214 | "product_id": "37",
215 | "quantity": "24"
216 | },
217 | {
218 | "title": "Flying Ninja",
219 | "product_id": "70",
220 | "quantity": "14"
221 | },
222 | {
223 | "title": "Happy Ninja",
224 | "product_id": "53",
225 | "quantity": "6"
226 | },
227 | {
228 | "title": "Ninja Silhouette",
229 | "product_id": "31",
230 | "quantity": "3"
231 | },
232 | {
233 | "title": "Woo Logo",
234 | "product_id": "15",
235 | "quantity": "3"
236 | },
237 | {
238 | "title": "Woo Album #1",
239 | "product_id": "83",
240 | "quantity": "3"
241 | },
242 | {
243 | "title": "Woo Album #4",
244 | "product_id": "96",
245 | "quantity": "1"
246 | },
247 | {
248 | "title": "Premium Quality",
249 | "product_id": "19",
250 | "quantity": "1"
251 | },
252 | {
253 | "title": "Ninja Silhouette",
254 | "product_id": "56",
255 | "quantity": "1"
256 | }
257 | ]
258 | }
259 | ```
260 |
--------------------------------------------------------------------------------
/source/includes/v3/_reports.md:
--------------------------------------------------------------------------------
1 | # Reports #
2 |
3 | This section lists all API endpoints that can be used view reports.
4 |
5 | ## Reports Filters ##
6 |
7 | Use the following filters for any type of report to specify the period of sales:
8 |
9 | | Filter | Type | Description |
10 | | ---------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11 | | `period` | string | The supported periods are: `week`, `month`, `last_month`, and `year`. If you use an invalid period, `week` is used. If you don't specify a period, the current day is used |
12 | | `date_min` | string | Return sales for a specific start date. The date need to be in the `YYYY-MM-DD` format |
13 | | `date_max` | string | Return sales for a specific end date. The dates need to be in the `YYYY-MM-DD` format. Required to set the `filter[date_min]` too |
14 |
15 | ## View List of Reports ##
16 |
17 | This API lets you retrieve and view a simple list of available reports.
18 |
19 | ### HTTP Request ###
20 |
21 |
22 |
23 | GET
24 |
/wc-api/v3/reports
25 |
26 |
27 |
28 | ```shell
29 | curl https://example.com/wc-api/v3/reports \
30 | -u consumer_key:consumer_secret
31 | ```
32 |
33 | ```javascript
34 | WooCommerce.get('reports', function(err, data, res) {
35 | console.log(res);
36 | });
37 | ```
38 |
39 | ```php
40 | get('reports')); ?>
41 | ```
42 |
43 | ```python
44 | print(wcapi.get("reports").json())
45 | ```
46 |
47 | ```ruby
48 | woocommerce.get("reports").parsed_response
49 | ```
50 |
51 | > JSON response example:
52 |
53 | ```json
54 | {
55 | "reports": [
56 | "sales",
57 | "sales/top_sellers"
58 | ]
59 | }
60 | ```
61 |
62 | ## View List of Sales Report ##
63 |
64 | This API lets you retrieve and view a list of sales report.
65 |
66 | ### HTTP Request ###
67 |
68 |
69 |
70 | GET
71 |
/wc-api/v3/reports/sales
72 |
73 |
74 |
75 | ```shell
76 | curl https://example.com/wc-api/v3/reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21 \
77 | -u consumer_key:consumer_secret
78 | ```
79 |
80 | ```javascript
81 | WooCommerce.get('reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21', function(err, data, res) {
82 | console.log(res);
83 | });
84 | ```
85 |
86 | ```php
87 | [
90 | 'date_min' => '2015-01-18',
91 | 'date_max' => '2015-01-21'
92 | ]
93 | ];
94 |
95 | print_r($woocommerce->get('reports/sales', $query));
96 | ?>
97 | ```
98 |
99 | ```python
100 | print(wcapi.get("reports/sales?filter[date_min]=2015-01-18&filter[date_max]=2015-01-21").json())
101 | ```
102 |
103 | ```ruby
104 | query = {
105 | filter: {
106 | date_min: "2015-01-18",
107 | date_max: "2015-01-21"
108 | }
109 | }
110 |
111 | woocommerce.get("reports/sales", query).parsed_response
112 | ```
113 |
114 | > JSON response example:
115 |
116 | ```json
117 | {
118 | "sales": {
119 | "total_sales": "580.10",
120 | "average_sales": "145.03",
121 | "total_orders": 4,
122 | "total_items": 31,
123 | "total_tax": "26.10",
124 | "total_shipping": "20.00",
125 | "total_discount": "0.00",
126 | "totals_grouped_by": "day",
127 | "totals": {
128 | "2015-01-18": {
129 | "sales": "-17.00",
130 | "orders": 1,
131 | "items": 1,
132 | "tax": "0.00",
133 | "shipping": "0.00",
134 | "discount": "0.00",
135 | "customers": 0
136 | },
137 | "2015-01-19": {
138 | "sales": "0.00",
139 | "orders": 0,
140 | "items": 0,
141 | "tax": "0.00",
142 | "shipping": "0.00",
143 | "discount": "0.00",
144 | "customers": 0
145 | },
146 | "2015-01-20": {
147 | "sales": "0.00",
148 | "orders": 0,
149 | "items": 0,
150 | "tax": "0.00",
151 | "shipping": "0.00",
152 | "discount": "0.00",
153 | "customers": 0
154 | },
155 | "2015-01-21": {
156 | "sales": "597.10",
157 | "orders": 3,
158 | "items": 30,
159 | "tax": "26.10",
160 | "shipping": "20.00",
161 | "discount": "0.00",
162 | "customers": 0
163 | }
164 | },
165 | "total_customers": 0
166 | }
167 | }
168 | ```
169 |
170 | ## View List of Top Sellers Report ##
171 |
172 | This API lets you retrieve and view a list of top sellers report.
173 |
174 | ### HTTP Request ###
175 |
176 |
177 |
178 | GET
179 |
/wc-api/v3/reports/sales/top_sellers
180 |
181 |
182 |
183 | ```shell
184 | curl https://example.com/wc-api/v3/reports/sales/top_sellers?filter[period]=last_month \
185 | -u consumer_key:consumer_secret
186 | ```
187 |
188 | ```javascript
189 | WooCommerce.get('reports/sales/top_sellers?filter[period]=last_month', function(err, data, res) {
190 | console.log(res);
191 | });
192 | ```
193 |
194 | ```php
195 | [
198 | 'period' => 'last_month'
199 | ]
200 | ];
201 |
202 | print_r($woocommerce->get('reports/sales/top_sellers', $query));
203 | ?>
204 | ```
205 |
206 | ```python
207 | print(wcapi.get("reports/sales/top_sellers?filter[period]=last_month").json())
208 | ```
209 |
210 | ```ruby
211 | query = {
212 | filter: {
213 | period: "last_month"
214 | }
215 | }
216 |
217 | woocommerce.get("reports/sales/top_sellers", query).parsed_response
218 | ```
219 |
220 | > JSON response example:
221 |
222 | ```json
223 | {
224 | "top_sellers": [
225 | {
226 | "title": "Happy Ninja",
227 | "product_id": "37",
228 | "quantity": "24"
229 | },
230 | {
231 | "title": "Flying Ninja",
232 | "product_id": "70",
233 | "quantity": "14"
234 | },
235 | {
236 | "title": "Happy Ninja",
237 | "product_id": "53",
238 | "quantity": "6"
239 | },
240 | {
241 | "title": "Ninja Silhouette",
242 | "product_id": "31",
243 | "quantity": "3"
244 | },
245 | {
246 | "title": "Woo Logo",
247 | "product_id": "15",
248 | "quantity": "3"
249 | },
250 | {
251 | "title": "Woo Album #1",
252 | "product_id": "83",
253 | "quantity": "3"
254 | },
255 | {
256 | "title": "Woo Album #4",
257 | "product_id": "96",
258 | "quantity": "1"
259 | },
260 | {
261 | "title": "Premium Quality",
262 | "product_id": "19",
263 | "quantity": "1"
264 | },
265 | {
266 | "title": "Ninja Silhouette",
267 | "product_id": "56",
268 | "quantity": "1"
269 | }
270 | ]
271 | }
272 | ```
273 |
--------------------------------------------------------------------------------
/source/includes/wp-api-v3/_order-actions.md:
--------------------------------------------------------------------------------
1 | # Order actions #
2 |
3 | The order actions API allows you to perform specific actions with existing orders like you can from the Edit Order screen in the web app.
4 |
5 | _Note: currently only some actions are available, other actions will be introduced at a later time._
6 |
7 | ## Send order details to customer ##
8 |
9 | This endpoint allows you to trigger an email to the customer with the details of their order. In case the order doesn't yet have a billing email set, you can specify an email recipient. However, if the order does have an existing billing email, this will return an error, unless you also specify that the existing email should be overwritten by using the `force_email_update` parameter.
10 |
11 | ### HTTP request ###
12 |
13 |
14 |
15 | POST
16 |
/wp-json/wc/v3/orders/<id>/actions/send_order_details
17 |
18 |
19 |
20 | ```shell
21 | curl -X POST https://example.com/wp-json/wc/v3/orders/723/actions/send_order_details \
22 | -u consumer_key:consumer_secret \
23 | -d '{
24 | "email": "somebody@example.com",
25 | "force_email_update": true
26 | }'
27 | ```
28 |
29 | ```javascript
30 | const data = {
31 | email: "somebody@example.com",
32 | force_email_update: true
33 | };
34 |
35 | WooCommerce.post("orders/723/actions/send_order_details", data)
36 | .then((response) => {
37 | console.log(response.data);
38 | })
39 | .catch((error) => {
40 | console.log(error.response.data);
41 | });
42 | ```
43 |
44 | ```php
45 | 'somebody@example.com',
48 | 'force_email_update' => true,
49 | ];
50 |
51 | print_r($woocommerce->post('orders/723/actions/send_order_details', $data));
52 | ?>
53 | ```
54 |
55 | ```python
56 | data = {
57 | "email": "somebody@example.com",
58 | "force_email_update": true
59 | }
60 |
61 | print(wcapi.post("orders/723/actions/send_order_details", data).json())
62 | ```
63 |
64 | ```ruby
65 | data = {
66 | "email": "somebody@example.com",
67 | "force_email_update": true
68 | }
69 |
70 | woocommerce.post("orders/723/actions/send_order_details", data).parsed_response
71 | ```
72 |
73 | > JSON response examples:
74 |
75 | ```json
76 | {
77 | "message": "Billing email updated to somebody@example.com. Order details sent to somebody@example.com, via REST API."
78 | }
79 | ```
80 |
81 | ```json
82 | {
83 | "code": "woocommerce_rest_missing_email",
84 | "message": "Order does not have an email address.",
85 | "data": {
86 | "status": 400
87 | }
88 | }
89 | ```
90 |
91 | ## Send order notification email to customer ##
92 |
93 | This endpoint allows you to trigger an email to a customer about the status of their order. This is similar to the [`send_order_details`](#send-order-details-to-customer) endpoint, but allows you to specify which email template to send, based on which email templates are relevant to the order. For example, an order that is on hold has the `customer_on_hold_order` template available. A completed order that also has a partial refund has both the `customer_completed_order` and `customer_refunded_order` templates available. Specifying the `customer_invoice` template is the same as using the `send_order_details` endpoint.
94 |
95 | ### HTTP request ###
96 |
97 |
98 |
99 | POST
100 |
/wp-json/wc/v3/orders/<id>/actions/send_email
101 |
102 |
103 |
104 | ```shell
105 | curl -X POST https://example.com/wp-json/wc/v3/orders/723/actions/send_email \
106 | -u consumer_key:consumer_secret \
107 | -d '{
108 | "template_id": "customer_completed_order",
109 | "email": "somebody@example.com",
110 | "force_email_update": true
111 | }'
112 | ```
113 |
114 | ```javascript
115 | const data = {
116 | template_id: "customer_completed_order",
117 | email: "somebody@example.com",
118 | force_email_update: true
119 | };
120 |
121 | WooCommerce.post("orders/723/actions/send_email", data)
122 | .then((response) => {
123 | console.log(response.data);
124 | })
125 | .catch((error) => {
126 | console.log(error.response.data);
127 | });
128 | ```
129 |
130 | ```php
131 | 'customer_completed_order',
134 | 'email' => 'somebody@example.com',
135 | 'force_email_update' => true,
136 | ];
137 |
138 | print_r($woocommerce->post('orders/723/actions/send_email', $data));
139 | ?>
140 | ```
141 |
142 | ```python
143 | data = {
144 | "template_id": "customer_completed_order",
145 | "email": "somebody@example.com",
146 | "force_email_update": true
147 | }
148 |
149 | print(wcapi.post("orders/723/actions/send_email", data).json())
150 | ```
151 |
152 | ```ruby
153 | data = {
154 | "template_id": "customer_completed_order",
155 | "email": "somebody@example.com",
156 | "force_email_update": true
157 | }
158 |
159 | woocommerce.post("orders/723/actions/send_email", data).parsed_response
160 | ```
161 |
162 | > JSON response examples:
163 |
164 | ```json
165 | {
166 | "message": "Billing email updated to somebody@example.com. Email template "Completed order" sent to somebody@example.com, via REST API."
167 | }
168 | ```
169 |
170 | ```json
171 | {
172 | "code": "woocommerce_rest_invalid_email_template",
173 | "message": "customer_completed_order is not a valid template for this order.",
174 | "data": {
175 | "status": 400
176 | }
177 | }
178 | ```
179 |
180 | ## Get available email templates for an order ##
181 |
182 | This endpoint allows you to retrieve a list of email templates that are available for the specified order. You can also get this data embedded in the response for the [`orders` endpoint](#list-all-orders).
183 |
184 | ### HTTP request ###
185 |
186 |
187 |
188 | GET
189 |
/wp-json/wc/v3/orders/<id>/actions/email_templates
190 |
191 |
192 |
193 | ```shell
194 | curl -X GET https://example.com/wp-json/wc/v3/orders/723/actions/email_templates \
195 | -u consumer_key:consumer_secret
196 | ```
197 |
198 | ```javascript
199 | WooCommerce.get("orders/723/actions/email_templates")
200 | .then((response) => {
201 | console.log(response.data);
202 | })
203 | .catch((error) => {
204 | console.log(error.response.data);
205 | });
206 | ```
207 |
208 | ```php
209 | get('orders/723/actions/email_templates'));
211 | ?>
212 | ```
213 |
214 | ```python
215 | print(wcapi.get("orders/723/actions/email_templates").json())
216 | ```
217 |
218 | ```ruby
219 | woocommerce.post("orders/723/actions/email_templates").parsed_response
220 | ```
221 |
222 | > JSON response examples:
223 |
224 | ```json
225 | [
226 | {
227 | "id": "customer_completed_order",
228 | "title": "Completed order",
229 | "description": "Order complete emails are sent to customers when their orders are marked completed and usually indicate that their orders have been shipped."
230 | },
231 | {
232 | "id": "customer_invoice",
233 | "title": "Order details",
234 | "description": "Order detail emails can be sent to customers containing their order information and payment links."
235 | }
236 | ]
237 | ```
238 |
--------------------------------------------------------------------------------
/source/includes/v3/_product-tags.md:
--------------------------------------------------------------------------------
1 | # Product - Tags #
2 |
3 | This section lists all API endpoints that can be used to create, edit or otherwise manipulate product tags.
4 |
5 | ## Product Tag Properties ##
6 |
7 | | Attribute | Type | Description |
8 | | ------------- | ------- | ------------------------------------------------------------------------------------ |
9 | | `id` | integer | Tag ID (term ID) read-only |
10 | | `name` | string | Tag name required |
11 | | `slug` | string | Tag slug |
12 | | `description` | string | Tag description |
13 | | `count` | integer | Shows the quantity of products in this tag read-only |
14 |
15 | ## Create a Product Tag ##
16 |
17 | This API helps you to create a new product tag.
18 |
19 | ### HTTP Request ###
20 |
21 |
22 |
23 | POST
24 |
/wc-api/v3/products/tags
25 |
26 |
27 |
28 | > Example of how to create a product tag:
29 |
30 | ```shell
31 | curl -X POST https://example.com/wc-api/v3/products/tags \
32 | -u consumer_key:consumer_secret \
33 | -H "Content-Type: application/json" \
34 | -d '{
35 | "product_tag": {
36 | "name": "Leather Shoes"
37 | }
38 | }'
39 | ```
40 |
41 | ```javascript
42 | var data = {
43 | product_tag: {
44 | name: 'Leather Shoes'
45 | }
46 | };
47 |
48 | WooCommerce.post('products/tags', data, function(err, data, res) {
49 | console.log(res);
50 | });
51 | ```
52 |
53 | ```php
54 | 'Leather Shoes'
58 | ]
59 | ];
60 |
61 | print_r($woocommerce->post('products/tags', $data));
62 | ?>
63 | ```
64 |
65 | ```python
66 | data = {
67 | "product_tag": {
68 | "name": "Leather Shoes"
69 | }
70 | }
71 |
72 | print(wcapi.post("products/tags", data).json())
73 | ```
74 |
75 | ```ruby
76 | data = {
77 | product_tag: {
78 | name: "Leather Shoes"
79 | }
80 | }
81 |
82 | woocommerce.post("products/tags", data).parsed_response
83 | ```
84 |
85 | > JSON response example:
86 |
87 | ```json
88 | {
89 | "product_tag": {
90 | "id": 37,
91 | "name": "Leather Shoes",
92 | "slug": "leather-shoes",
93 | "description": "",
94 | "count": 0
95 | }
96 | }
97 | ```
98 |
99 |
102 |
103 | ## View a Product Tag ##
104 |
105 | This API lets you retrieve a product tag by ID.
106 |
107 |
108 |
109 | GET
110 |
/wc-api/v3/products/tags/<id>
111 |
112 |
113 |
114 | ```shell
115 | curl https://example.com/wc-api/v3/products/tags/37 \
116 | -u consumer_key:consumer_secret
117 | ```
118 |
119 | ```javascript
120 | WooCommerce.get('products/tags/37', function(err, data, res) {
121 | console.log(res);
122 | });
123 | ```
124 |
125 | ```php
126 | get('products/tags/37')); ?>
127 | ```
128 |
129 | ```python
130 | print(wcapi.get("products/tags/37").json())
131 | ```
132 |
133 | ```ruby
134 | woocommerce.get("products/tags/37").parsed_response
135 | ```
136 |
137 | > JSON response example:
138 |
139 | ```json
140 | {
141 | "product_tag": {
142 | "id": 37,
143 | "name": "Leather Shoes",
144 | "slug": "leather-shoes",
145 | "description": "",
146 | "count": 0
147 | }
148 | }
149 | ```
150 |
151 |
154 |
155 | ## View List of Product Tags ##
156 |
157 | This API lets you retrieve all product tag.
158 |
159 |
160 |
161 | GET
162 |
/wc-api/v3/products/tags
163 |
164 |
165 |
166 | ```shell
167 | curl https://example.com/wc-api/v3/products/tags \
168 | -u consumer_key:consumer_secret
169 | ```
170 |
171 | ```javascript
172 | WooCommerce.get('products/tags', function(err, data, res) {
173 | console.log(res);
174 | });
175 | ```
176 |
177 | ```php
178 | get('products/tags')); ?>
179 | ```
180 |
181 | ```python
182 | print(wcapi.get("products/tags").json())
183 | ```
184 |
185 | ```ruby
186 | woocommerce.get("products/tags").parsed_response
187 | ```
188 |
189 | > JSON response example:
190 |
191 | ```json
192 | {
193 | "product_tags": [
194 | {
195 | "id": 37,
196 | "name": "Leather Shoes",
197 | "slug": "leather-shoes",
198 | "description": "",
199 | "count": 0
200 | },
201 | {
202 | "id": 38,
203 | "name": "Oxford Shoes",
204 | "slug": "oxford-shoes",
205 | "description": "",
206 | "count": 0
207 | }
208 | ]
209 | }
210 | ```
211 |
212 |
215 |
216 | ## Update a Product Tag ##
217 |
218 | This API lets you make changes to a product tag.
219 |
220 | ### HTTP Request ###
221 |
222 |
223 |
224 | PUT
225 |
/wc-api/v3/products/tags/<id>
226 |
227 |
228 |
229 | ```shell
230 | curl -X PUT https://example.com/wc-api/v3/products/tags/37 \
231 | -u consumer_key:consumer_secret \
232 | -H "Content-Type: application/json" \
233 | -d '{
234 | "product_tag": {
235 | "description": "Genuine leather."
236 | }
237 | }'
238 | ```
239 |
240 | ```javascript
241 | var data = {
242 | product_tag: {
243 | description: 'Genuine leather.'
244 | }
245 | };
246 |
247 | WooCommerce.put('products/tags/37', data, function(err, data, res) {
248 | console.log(res);
249 | });
250 | ```
251 |
252 | ```php
253 | put('products/tags/37', $data));
261 | ?>
262 | ```
263 |
264 | ```python
265 | data = {
266 | "product_tag": {
267 | "description": "Genuine leather."
268 | }
269 | }
270 |
271 | print(wcapi.put("products/tags/37", data).json())
272 | ```
273 |
274 | ```ruby
275 | data = {
276 | product_tag: {
277 | description: "Genuine leather."
278 | }
279 | }
280 |
281 | woocommerce.put("products/tags/37", data).parsed_response
282 | ```
283 |
284 | > JSON response example:
285 |
286 | ```json
287 | {
288 | "product_tag": {
289 | "id": 37,
290 | "name": "Leather Shoes",
291 | "slug": "leather-shoes",
292 | "description": "Genuine leather.",
293 | "count": 0
294 | }
295 | }
296 | ```
297 |
298 |
301 |
302 | ## Delete a Product Tag ##
303 |
304 | This API helps you delete a product tag.
305 |
306 | ### HTTP Request ###
307 |
308 |
309 |
310 | DELETE
311 |
/wc-api/v3/products/tags/<id>
312 |
313 |
314 |
315 | ```shell
316 | curl -X DELETE https://example.com/wc-api/v3/products/tags/37 \
317 | -u consumer_key:consumer_secret
318 | ```
319 |
320 | ```javascript
321 | WooCommerce.delete('products/tags/37', function(err, data, res) {
322 | console.log(res);
323 | });
324 | ```
325 |
326 | ```php
327 | delete('products/tags/37')); ?>
328 | ```
329 |
330 | ```python
331 | print(wcapi.delete("products/tags/37").json())
332 | ```
333 |
334 | ```ruby
335 | woocommerce.delete("products/tags/37").parsed_response
336 | ```
337 |
338 | > JSON response example:
339 |
340 | ```json
341 | {
342 | "message": "Deleted product_tag"
343 | }
344 | ```
345 |
346 |
349 |
--------------------------------------------------------------------------------
/source/includes/v3/_order-notes.md:
--------------------------------------------------------------------------------
1 | # Order - Notes #
2 |
3 | This section lists all API endpoints that can be used to create, edit or otherwise manipulate order notes.
4 |
5 | ## Order Notes Properties ##
6 |
7 | | Attribute | Type | Description |
8 | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------ |
9 | | `id` | integer | Order note ID read-only |
10 | | `created_at` | string | UTC DateTime when the order note was created read-only |
11 | | `note` | string | Order note required |
12 | | `customer_note` | boolean | Shows/define if the note is only for reference or for the customer (the user will be notified). Default is `false` |
13 |
14 | ## Create a Note For an Order ##
15 |
16 | This API helps you to create a new note for an order.
17 |
18 | ### HTTP Request ###
19 |
20 |
21 |
22 | POST
23 |
/wc-api/v3/orders/<id>/notes
24 |
25 |
26 |
27 | ```shell
28 | curl -X POST https://example.com/wc-api/v3/orders/645/notes \
29 | -u consumer_key:consumer_secret \
30 | -H "Content-Type: application/json" \
31 | -d '{
32 | "order_note": {
33 | "note": "Order ok!!!"
34 | }
35 | }'
36 | ```
37 |
38 | ```javascript
39 | var data = {
40 | order_note: {
41 | note: 'Order ok!!!'
42 | }
43 | };
44 |
45 | WooCommerce.post('orders/645/notes', data, function(err, data, res) {
46 | console.log(res);
47 | });
48 | ```
49 |
50 | ```php
51 | [
54 | 'note' => 'Order ok!!!'
55 | ]
56 | ];
57 |
58 | print_r($woocommerce->post('orders/645/notes', $data));
59 | ?>
60 | ```
61 |
62 | ```python
63 | data = {
64 | "order_note": {
65 | "note": "Order ok!!!"
66 | }
67 | }
68 |
69 | print(wcapi.post("orders/645/notes", data).json())
70 | ```
71 |
72 | ```ruby
73 | data = {
74 | order_note: {
75 | note: "Order ok!!!"
76 | }
77 | }
78 |
79 | woocommerce.post("orders/645/notes", data).parsed_response
80 | ```
81 |
82 | > JSON response example:
83 |
84 | ```json
85 | {
86 | "order_note": {
87 | "id": "416",
88 | "created_at": "2015-01-26T20:56:44Z",
89 | "note": "Order ok!!!",
90 | "customer_note": false
91 | }
92 | }
93 | ```
94 |
95 | ## View an Order Note ##
96 |
97 | This API lets you retrieve and view a specific note from an order.
98 |
99 | ### HTTP Request ###
100 |
101 |
102 |
103 | GET
104 |
/wc-api/v3/orders/<id>/notes/<note_id>
105 |
106 |
107 |
108 | ```shell
109 | curl https://example.com/wc-api/v3/orders/645/notes/416 \
110 | -u consumer_key:consumer_secret
111 | ```
112 |
113 | ```javascript
114 | WooCommerce.get('orders/645/notes/416', function(err, data, res) {
115 | console.log(res);
116 | });
117 | ```
118 |
119 | ```php
120 | get('orders/645/notes/416')); ?>
121 | ```
122 |
123 | ```python
124 | print(wcapi.get("orders/645/notes/416").json())
125 | ```
126 |
127 | ```ruby
128 | woocommerce.get("orders/645/notes/416").parsed_response
129 | ```
130 |
131 | > JSON response example:
132 |
133 | ```json
134 | {
135 | "order_note": {
136 | "id": "416",
137 | "created_at": "2015-01-26T20:56:44Z",
138 | "note": "Order ok!!!",
139 | "customer_note": false
140 | }
141 | }
142 | ```
143 |
144 | ## View List of Notes From an Order ##
145 |
146 | This API helps you to view all the notes from an order.
147 |
148 | ### HTTP Request ###
149 |
150 |
151 |
152 | GET
153 |
/wc-api/v3/orders/<id>/notes
154 |
155 |
156 |
157 | ```shell
158 | curl https://example.com/wc-api/v3/orders/645/notes \
159 | -u consumer_key:consumer_secret
160 | ```
161 |
162 | ```javascript
163 | WooCommerce.get('orders/645/notes', function(err, data, res) {
164 | console.log(res);
165 | });
166 | ```
167 |
168 | ```php
169 | get('orders/645/notes')); ?>
170 | ```
171 |
172 | ```python
173 | print(wcapi.get("orders/645/notes").json())
174 | ```
175 |
176 | ```ruby
177 | woocommerce.get("orders/645/notes").parsed_response
178 | ```
179 |
180 | > JSON response example:
181 |
182 | ```json
183 | {
184 | "order_notes": [
185 | {
186 | "id": "416",
187 | "created_at": "2015-01-26T20:56:44Z",
188 | "note": "Order ok!!!",
189 | "customer_note": false
190 | },
191 | {
192 | "id": "415",
193 | "created_at": "2015-01-26T20:16:14Z",
194 | "note": "Order status changed from Processing to Completed.",
195 | "customer_note": false
196 | },
197 | {
198 | "id": "412",
199 | "created_at": "2015-01-26T20:00:21Z",
200 | "note": "Order item stock reduced successfully.",
201 | "customer_note": false
202 | },
203 | {
204 | "id": "411",
205 | "created_at": "2015-01-26T20:00:09Z",
206 | "note": "Order status changed from Pending Payment to Processing.",
207 | "customer_note": false
208 | }
209 | ]
210 | }
211 | ```
212 |
213 | ## Update an Order Note ##
214 |
215 | This API lets you make changes to an order note.
216 |
217 | ### HTTP Request ###
218 |
219 |
220 |
221 | PUT
222 |
/wc-api/v3/orders/<id>/notes/<note_id>
223 |
224 |
225 |
226 | ```shell
227 | curl -X PUT https://example.com/wc-api/v3/orders/645/notes/416 \
228 | -u consumer_key:consumer_secret \
229 | -H "Content-Type: application/json" \
230 | -d '{
231 | "order_note": {
232 | "note": "Ok!"
233 | }
234 | }'
235 | ```
236 |
237 | ```javascript
238 | var data = {
239 | order_note: {
240 | note: 'Ok!'
241 | }
242 | };
243 |
244 | WooCommerce.put('orders/645/notes/416', data, function(err, data, res) {
245 | console.log(res);
246 | });
247 | ```
248 |
249 | ```php
250 | [
253 | 'note' => 'Ok!'
254 | ]
255 | ];
256 |
257 | print_r($woocommerce->put('orders/645/notes/416', $data));
258 | ?>
259 | ```
260 |
261 | ```python
262 | data = {
263 | "order_note": {
264 | "note": "Ok!"
265 | }
266 | }
267 |
268 | print(wcapi.put("orders/645/notes/416", data).json())
269 | ```
270 |
271 | ```ruby
272 | data = {
273 | order_note: {
274 | note: "Ok!"
275 | }
276 | }
277 |
278 | woocommerce.put("orders/645/notes/416", data).parsed_response
279 | ```
280 |
281 | > JSON response example:
282 |
283 | ```json
284 | {
285 | "order_note": {
286 | "id": "416",
287 | "created_at": "2015-01-26T20:56:44Z",
288 | "note": "Ok!",
289 | "customer_note": false
290 | }
291 | }
292 | ```
293 |
294 | ## Delete an Order Note ##
295 |
296 | This API helps you delete an order note.
297 |
298 | ### HTTP Request ###
299 |
300 |
301 |
302 | DELETE
303 |
/wc-api/v3/orders/<id>/notes/<note_id>
304 |
305 |
306 |
307 | ```shell
308 | curl -X DELETE https://example.com/wc-api/v3/orders/645/notes/416 \
309 | -u consumer_key:consumer_secret
310 | ```
311 |
312 | ```javascript
313 | WooCommerce.delete('orders/645/notes/416', function(err, data, res) {
314 | console.log(res);
315 | });
316 | ```
317 |
318 | ```php
319 | delete('orders/645/notes/416')); ?>
320 | ```
321 |
322 | ```python
323 | print(wcapi.delete("orders/645/notes/416").json())
324 | ```
325 |
326 | ```ruby
327 | woocommerce.delete("orders/645/notes/416").parsed_response
328 | ```
329 |
330 | > JSON response example:
331 |
332 | ```json
333 | {
334 | "message": "Permanently deleted order note"
335 | }
336 | ```
337 |
--------------------------------------------------------------------------------
/source/includes/v3/_order-refunds.md:
--------------------------------------------------------------------------------
1 | # Order - Refunds #
2 |
3 | This section lists all API endpoints that can be used to create, edit or otherwise manipulate order refunds.
4 |
5 | ## Order Refunds Properties ##
6 |
7 | | Attribute | Type | Description |
8 | |--------------|---------|------------------------------------------------------------------------------------------|
9 | | `id` | integer | Order note ID read-only |
10 | | `created_at` | string | UTC DateTime when the order refund was created read-only |
11 | | `amount` | string | Refund amount required |
12 | | `reason` | string | Reason for refund |
13 | | `line_items` | array | List of order items to refund. See [Line Items Properties](#line-items-properties) |
14 |
15 | ## Create a Refund For an Order ##
16 |
17 | This API helps you to create a new refund for an order.
18 |
19 | ### HTTP Request ###
20 |
21 |
22 |
23 | POST
24 |
/wc-api/v3/orders/<id>/refunds
25 |
26 |
27 |
28 | ```shell
29 | curl -X POST https://example.com/wc-api/v3/orders/645/refunds \
30 | -u consumer_key:consumer_secret \
31 | -H "Content-Type: application/json" \
32 | -d '{
33 | "order_refund": {
34 | "amount": 10
35 | }
36 | }'
37 | ```
38 |
39 | ```javascript
40 | var data = {
41 | order_refund: {
42 | amount: 10
43 | }
44 | };
45 |
46 | WooCommerce.post('orders/645/refunds', data, function(err, data, res) {
47 | console.log(res);
48 | });
49 | ```
50 |
51 | ```php
52 | [
55 | 'amount' => 10
56 | ]
57 | ];
58 |
59 | print_r($woocommerce->post('orders/645/refunds', $data));
60 | ?>
61 | ```
62 |
63 | ```python
64 | data = {
65 | "order_refund": {
66 | "amount": 10
67 | }
68 | }
69 |
70 | print(wcapi.post("orders/645/refunds", data).json())
71 | ```
72 |
73 | ```ruby
74 | data = {
75 | order_refund: {
76 | amount: 10
77 | }
78 | }
79 |
80 | woocommerce.post("orders/645/refunds", data).parsed_response
81 | ```
82 |
83 | > JSON response example:
84 |
85 | ```json
86 | {
87 | "order_refund": {
88 | "id": 649,
89 | "created_at": "2015-01-26T19:29:32Z",
90 | "amount": "10.00",
91 | "reason": "",
92 | "line_items": []
93 | }
94 | }
95 | ```
96 |
97 | ## View an Order Refund ##
98 |
99 | This API lets you retrieve and view a specific refund from an order.
100 |
101 | ### HTTP Request ###
102 |
103 |
104 |
105 | GET
106 |
/wc-api/v3/orders/<id>/refunds/<refund_id>
107 |
108 |
109 |
110 | ```shell
111 | curl https://example.com/wc-api/v3/orders/645/refunds/649 \
112 | -u consumer_key:consumer_secret
113 | ```
114 |
115 | ```javascript
116 | WooCommerce.get('orders/645/refunds/649', function(err, data, res) {
117 | console.log(res);
118 | });
119 | ```
120 |
121 | ```php
122 | get('orders/645/refunds/649')); ?>
123 | ```
124 |
125 | ```python
126 | print(wcapi.get("orders/645/refunds/649").json())
127 | ```
128 |
129 | ```ruby
130 | woocommerce.get("orders/645/refunds/649").parsed_response
131 | ```
132 |
133 | > JSON response example:
134 |
135 | ```json
136 | {
137 | "order_refund": {
138 | "id": 649,
139 | "created_at": "2015-01-26T19:29:32Z",
140 | "amount": "10.00",
141 | "reason": "",
142 | "line_items": []
143 | }
144 | }
145 | ```
146 |
147 | ## View List of Refunds From an Order ##
148 |
149 | This API helps you to view all the refunds from an order.
150 |
151 | ### HTTP Request ###
152 |
153 |
154 |
155 | GET
156 |
/wc-api/v3/orders/<id>/refunds
157 |
158 |
159 |
160 | ```shell
161 | curl https://example.com/wc-api/v3/orders/645/refunds \
162 | -u consumer_key:consumer_secret
163 | ```
164 |
165 | ```javascript
166 | WooCommerce.get('orders/645/refunds', function(err, data, res) {
167 | console.log(res);
168 | });
169 | ```
170 |
171 | ```php
172 | get('orders/645/refunds')); ?>
173 | ```
174 |
175 | ```python
176 | print(wcapi.get("orders/645/refunds").json())
177 | ```
178 |
179 | ```ruby
180 | woocommerce.get("orders/645/refunds").parsed_response
181 | ```
182 |
183 | > JSON response example:
184 |
185 | ```json
186 | {
187 | "order_refunds": [
188 | {
189 | "id": 649,
190 | "created_at": "2015-01-26T19:29:32Z",
191 | "amount": "10.00",
192 | "reason": "",
193 | "line_items": []
194 | },
195 | {
196 | "id": 647,
197 | "created_at": "2015-01-26T19:19:06Z",
198 | "amount": "21.99",
199 | "reason": "",
200 | "line_items": [
201 | {
202 | "id": 514,
203 | "subtotal": "-21.99",
204 | "subtotal_tax": "0.00",
205 | "total": "-21.99",
206 | "total_tax": "0.00",
207 | "price": "-21.99",
208 | "quantity": 1,
209 | "tax_class": "reduced-rate",
210 | "name": "Premium Quality",
211 | "product_id": 546,
212 | "sku": "",
213 | "meta": []
214 | },
215 | {
216 | "id": 515,
217 | "subtotal": "0.00",
218 | "subtotal_tax": "0.00",
219 | "total": "0.00",
220 | "total_tax": "0.00",
221 | "price": "0.00",
222 | "quantity": 0,
223 | "tax_class": null,
224 | "name": "Ship Your Idea",
225 | "product_id": 613,
226 | "sku": "",
227 | "meta": []
228 | }
229 | ]
230 | }
231 | ]
232 | }
233 | ```
234 |
235 | ## Update an Order Refund ##
236 |
237 | This API lets you make changes to an order refund.
238 |
239 | ### HTTP Request ###
240 |
241 |
242 |
243 | PUT
244 |
/wc-api/v3/orders/<id>/refunds/<refund_id>
245 |
246 |
247 |
248 | ```shell
249 | curl -X PUT https://example.com/wc-api/v3/orders/645/refunds/649 \
250 | -u consumer_key:consumer_secret \
251 | -H "Content-Type: application/json" \
252 | -d '{
253 | "order_refund": {
254 | "reason": "Because was it necessary!"
255 | }
256 | }'
257 | ```
258 |
259 | ```javascript
260 | var data = {
261 | order_refund: {
262 | reason: 'Because was it necessary!'
263 | }
264 | };
265 |
266 | WooCommerce.put('orders/645/refunds/649', data, function(err, data, res) {
267 | console.log(res);
268 | });
269 | ```
270 |
271 | ```php
272 | [
275 | 'reason' => 'Because was it necessary!'
276 | ]
277 | ];
278 |
279 | print_r($woocommerce->put('orders/645/refunds/649', $data));
280 | ?>
281 | ```
282 |
283 | ```python
284 | data = {
285 | "order_refund": {
286 | "reason": "Because was it necessary!"
287 | }
288 | }
289 |
290 | print(wcapi.put("orders/645/refunds/649", data).json())
291 | ```
292 |
293 | ```ruby
294 | data = {
295 | order_refund: {
296 | reason: "Because was it necessary!"
297 | }
298 | }
299 |
300 | woocommerce.put("orders/645/refunds/649", data).parsed_response
301 | ```
302 |
303 | > JSON response example:
304 |
305 | ```json
306 | {
307 | "order_refund": {
308 | "id": 649,
309 | "created_at": "2015-01-26T19:29:32Z",
310 | "amount": "10.00",
311 | "reason": "Because was it necessary!",
312 | "line_items": []
313 | }
314 | }
315 | ```
316 |
317 | ## Delete an Order Refund ##
318 |
319 | This API helps you delete an order refund.
320 |
321 | ### HTTP Request ###
322 |
323 |
324 |
325 | DELETE
326 |
/wc-api/v3/orders/<id>/refunds/<refund_id>
327 |
328 |
329 |
330 | ```shell
331 | curl -X DELETE https://example.com/wc-api/v3/orders/645/refunds/649 \
332 | -u consumer_key:consumer_secret
333 | ```
334 |
335 | ```javascript
336 | WooCommerce.delete('orders/645/refunds/649', function(err, data, res) {
337 | console.log(res);
338 | });
339 | ```
340 |
341 | ```php
342 | delete('orders/645/refunds/649')); ?>
343 | ```
344 |
345 | ```python
346 | print(wcapi.delete("orders/645/refunds/649").json())
347 | ```
348 |
349 | ```ruby
350 | woocommerce.delete("orders/645/refunds/649").parsed_response
351 | ```
352 |
353 | > JSON response example:
354 |
355 | ```json
356 | {
357 | "message": "Permanently deleted refund"
358 | }
359 | ```
360 |
--------------------------------------------------------------------------------
/source/includes/v3/_product-attributes.md:
--------------------------------------------------------------------------------
1 | # Product - Attributes #
2 |
3 | This section lists all API endpoints that can be used to create, edit or otherwise manipulate product attributes.
4 |
5 | ## Product Attribute Properties ##
6 |
7 | | Attribute | Type | Description |
8 | | -------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
9 | | `id` | integer | Attribute ID read-only |
10 | | `name` | string | Attribute name |
11 | | `slug` | string | Attribute slug |
12 | | `type` | string | Attribute type, the types available include by default are: `select` and `text` (some plugins can include new types) |
13 | | `order_by` | string | Default sort order. Available: `menu_order`, `name`, `name_num` and `id` |
14 | | `has_archives` | boolean | Enable/Disable attribute archives |
15 |
16 | ## Create a Product Attribute ##
17 |
18 | This API helps you to create a new product attribute.
19 |
20 | ### HTTP Request ###
21 |
22 |
23 |
24 | POST
25 |
/wc-api/v3/products/attributes
26 |
27 |
28 |
29 | ```shell
30 | curl -X POST https://example.com/wc-api/v3/products/attributes \
31 | -u consumer_key:consumer_secret \
32 | -H "Content-Type: application/json" \
33 | -d '{
34 | "product_attribute": {
35 | "name": "Color",
36 | "slug": "pa_color",
37 | "type": "select",
38 | "order_by": "menu_order",
39 | "has_archives": true
40 | }
41 | }'
42 | ```
43 |
44 | ```javascript
45 | var data = {
46 | product_attribute: {
47 | name: 'Color',
48 | slug: 'pa_color',
49 | type: 'select',
50 | order_by: 'menu_order',
51 | has_archives: true
52 | }
53 | };
54 |
55 | WooCommerce.post('products/attributes', data, function(err, data, res) {
56 | console.log(res);
57 | });
58 | ```
59 |
60 | ```php
61 | [
64 | 'name' => 'Color',
65 | 'slug' => 'pa_color',
66 | 'type' => 'select',
67 | 'order_by' => 'menu_order',
68 | 'has_archives' => true
69 | ]
70 | ];
71 |
72 | print_r($woocommerce->post('products/attributes', $data));
73 | ?>
74 | ```
75 |
76 | ```python
77 | data = {
78 | "product_attribute": {
79 | "name": "Color",
80 | "slug": "pa_color",
81 | "type": "select",
82 | "order_by": "menu_order",
83 | "has_archives": True
84 | }
85 | }
86 |
87 | print(wcapi.post("products/attributes", data).json())
88 | ```
89 |
90 | ```ruby
91 | data = {
92 | product_attribute: {
93 | name: "Color",
94 | slug: "pa_color",
95 | type: "select",
96 | order_by: "menu_order",
97 | has_archives: true
98 | }
99 | }
100 |
101 | woocommerce.post("products/attributes", data).parsed_response
102 | ```
103 |
104 | > JSON response example:
105 |
106 | ```json
107 | {
108 | "product_attribute": {
109 | "id": 1,
110 | "name": "Color",
111 | "slug": "pa_color",
112 | "type": "select",
113 | "order_by": "menu_order",
114 | "has_archives": true
115 | }
116 | }
117 | ```
118 |
119 | ## View a Product Attribute ##
120 |
121 | This API lets you retrieve and view a specific product attribute by ID.
122 |
123 |
124 |
125 | GET
126 |
/wc-api/v3/products/attributes/<id>
127 |
128 |
129 |
130 | ```shell
131 | curl https://example.com/wc-api/v3/products/attributes/1 \
132 | -u consumer_key:consumer_secret
133 | ```
134 |
135 | ```javascript
136 | WooCommerce.get('products/attributes/1', function(err, data, res) {
137 | console.log(res);
138 | });
139 | ```
140 |
141 | ```php
142 | get('products/attributes/1')); ?>
143 | ```
144 |
145 | ```python
146 | print(wcapi.get("products/attributes/1").json())
147 | ```
148 |
149 | ```ruby
150 | woocommerce.get("products/attributes/1").parsed_response
151 | ```
152 |
153 | > JSON response example:
154 |
155 | ```json
156 | {
157 | "product_attribute": {
158 | "id": 1,
159 | "name": "Color",
160 | "slug": "pa_color",
161 | "type": "select",
162 | "order_by": "menu_order",
163 | "has_archives": true
164 | }
165 | }
166 | ```
167 |
168 | ## View List of Product Attributes ##
169 |
170 | This API helps you to view all the product attributes.
171 |
172 | ### HTTP Request ###
173 |
174 |
175 |
176 | GET
177 |
/wc-api/v3/products/attributes
178 |
179 |
180 |
181 | ```shell
182 | curl https://example.com/wc-api/v3/products/attributes \
183 | -u consumer_key:consumer_secret
184 | ```
185 |
186 | ```javascript
187 | WooCommerce.get('products/attributes', function(err, data, res) {
188 | console.log(res);
189 | });
190 | ```
191 |
192 | ```php
193 | get('products/attributes')); ?>
194 | ```
195 |
196 | ```python
197 | print(wcapi.get("products/attributes").json())
198 | ```
199 |
200 | ```ruby
201 | woocommerce.get("products/attributes").parsed_response
202 | ```
203 |
204 | > JSON response example:
205 |
206 | ```json
207 | {
208 | "product_attributes": [
209 | {
210 | "id": 1,
211 | "name": "Color",
212 | "slug": "pa_color",
213 | "type": "select",
214 | "order_by": "menu_order",
215 | "has_archives": true
216 | },
217 | {
218 | "id": 2,
219 | "name": "Size",
220 | "slug": "pa_size",
221 | "type": "select",
222 | "order_by": "menu_order",
223 | "has_archives": false
224 | }
225 | ]
226 | }
227 | ```
228 |
229 | ## Update a Product Attribute ##
230 |
231 | This API lets you make changes to a product attribute.
232 |
233 | ### HTTP Request ###
234 |
235 |
236 |
237 | PUT
238 |
/wc-api/v3/products/attributes/<id>
239 |
240 |
241 |
242 | ```shell
243 | curl -X PUT https://example.com/wc-api/v3/products/attributes/1 \
244 | -u consumer_key:consumer_secret \
245 | -H "Content-Type: application/json" \
246 | -d '{
247 | "product_attribute": {
248 | "order_by": "name"
249 | }
250 | }'
251 | ```
252 |
253 | ```javascript
254 | var data = {
255 | product_attribute: {
256 | order_by: 'name'
257 | }
258 | };
259 |
260 | WooCommerce.put('products/attributes/1', data, function(err, data, res) {
261 | console.log(res);
262 | });
263 | ```
264 |
265 | ```php
266 | [
269 | 'order_by' => 'name'
270 | ]
271 | ];
272 |
273 | print_r($woocommerce->put('products/attributes/1', $data));
274 | ?>
275 | ```
276 |
277 | ```python
278 | data = {
279 | "product_attribute": {
280 | "order_by": "name"
281 | }
282 | }
283 |
284 | print(wcapi.put("products/attributes/1", data).json())
285 | ```
286 |
287 | ```ruby
288 | data = {
289 | product_attribute: {
290 | order_by: "name"
291 | }
292 | }
293 |
294 | woocommerce.put("products/attributes/1", data).parsed_response
295 | ```
296 |
297 | > JSON response example:
298 |
299 | ```json
300 | {
301 | "product_attribute": {
302 | "id": 1,
303 | "name": "Color",
304 | "slug": "pa_color",
305 | "type": "select",
306 | "order_by": "name",
307 | "has_archives": true
308 | }
309 | }
310 | ```
311 |
312 | ## Delete a Product Attribute ##
313 |
314 | This API helps you delete a product attribute.
315 |
316 | ### HTTP Request ###
317 |
318 |
319 |
320 | DELETE
321 |
/wc-api/v3/products/attributes/<id>
322 |
323 |
324 |
325 | ```shell
326 | curl -X DELETE https://example.com/wc-api/v3/products/attributes/1 \
327 | -u consumer_key:consumer_secret
328 | ```
329 |
330 | ```javascript
331 | WooCommerce.delete('products/attributes/1', function(err, data, res) {
332 | console.log(res);
333 | });
334 | ```
335 |
336 | ```php
337 | delete('products/attributes/1')); ?>
338 | ```
339 |
340 | ```python
341 | print(wcapi.delete("products/attributes/1").json())
342 | ```
343 |
344 | ```ruby
345 | woocommerce.delete("products/attributes/1").parsed_response
346 | ```
347 |
348 | > JSON response example:
349 |
350 | ```json
351 | {
352 | "message": "Deleted product_attribute"
353 | }
354 | ```
355 |
--------------------------------------------------------------------------------
/source/includes/v3/_product-attribute-terms.md:
--------------------------------------------------------------------------------
1 | # Product - Attribute Terms #
2 |
3 | This section lists all API endpoints that can be used to create, edit or otherwise manipulate product attribute terms.
4 |
5 | ## Product Attribute Properties ##
6 |
7 | | Attribute | Type | Description |
8 | | --------- | ------- | ------------------------------------------------------------------------------------- |
9 | | `id` | integer | Term ID (term ID) read-only |
10 | | `name` | string | Term name required |
11 | | `slug` | string | Term slug |
12 | | `count` | integer | Shows the quantity of products in this term read-only |
13 |
14 | ## Create a Product Attribute Term ##
15 |
16 | This API helps you to create a new product attribute term.
17 |
18 | ### HTTP Request ###
19 |
20 |
21 |
22 | POST
23 |
/wc-api/v3/products/attributes/<attribute_id>/terms
24 |
25 |
26 |
27 | ```shell
28 | curl -X POST https://example.com/wc-api/v3/products/attributes/1/terms \
29 | -u consumer_key:consumer_secret \
30 | -H "Content-Type: application/json" \
31 | -d '{
32 | "product_attribute_term": {
33 | "name": "Black"
34 | }
35 | }'
36 | ```
37 |
38 | ```javascript
39 | var data = {
40 | product_attribute_term: {
41 | name: 'Black'
42 | }
43 | };
44 |
45 | WooCommerce.post('products/attributes/1/terms', data, function(err, data, res) {
46 | console.log(res);
47 | });
48 | ```
49 |
50 | ```php
51 | [
54 | 'name' => 'Black'
55 | ]
56 | ];
57 |
58 | print_r($woocommerce->post('products/attributes/1/terms', $data));
59 | ?>
60 | ```
61 |
62 | ```python
63 | data = {
64 | "product_attribute_term": {
65 | "name": "Black"
66 | }
67 | }
68 |
69 | print(wcapi.post("products/attributes/1/terms", data).json())
70 | ```
71 |
72 | ```ruby
73 | data = {
74 | product_attribute_term: {
75 | name: "Black"
76 | }
77 | }
78 |
79 | woocommerce.post("products/attributes/1/terms", data).parsed_response
80 | ```
81 |
82 | > JSON response example:
83 |
84 | ```json
85 | {
86 | "product_attribute_term": {
87 | "id": 18,
88 | "name": "Black",
89 | "slug": "black",
90 | "count": 0
91 | }
92 | }
93 | ```
94 |
95 |
98 |
99 | ## View a Product Attribute Term ##
100 |
101 | This API lets you retrieve a product attribute term by ID.
102 |
103 |
104 |
105 | GET
106 |
/wc-api/v3/products/attributes/<attribute_id>/terms/<id>
107 |
108 |
109 |
110 | ```shell
111 | curl https://example.com/wc-api/v3/products/attributes/1/terms/18 \
112 | -u consumer_key:consumer_secret
113 | ```
114 |
115 | ```javascript
116 | WooCommerce.get('products/attributes/1/terms/18', function(err, data, res) {
117 | console.log(res);
118 | });
119 | ```
120 |
121 | ```php
122 | get('products/attributes/1/terms/18')); ?>
123 | ```
124 |
125 | ```python
126 | print(wcapi.get("products/attributes/1/terms/18").json())
127 | ```
128 |
129 | ```ruby
130 | woocommerce.get("products/attributes/1/terms/18").parsed_response
131 | ```
132 |
133 | > JSON response example:
134 |
135 | ```json
136 | {
137 | "product_attribute_term": {
138 | "id": 18,
139 | "name": "Black",
140 | "slug": "black",
141 | "count": 5
142 | }
143 | }
144 | ```
145 |
146 |
149 |
150 | ## View List of Product Attribute Terms ##
151 |
152 | This API lets you retrieve all terms from a product attribute.
153 |
154 |
155 |
156 | GET
157 |
/wc-api/v3/products/attributes/<attribute_id>/terms
158 |
159 |
160 |
161 | ```shell
162 | curl https://example.com/wc-api/v3/products/attributes/1/terms \
163 | -u consumer_key:consumer_secret
164 | ```
165 |
166 | ```javascript
167 | WooCommerce.get('products/attributes/1/terms', function(err, data, res) {
168 | console.log(res);
169 | });
170 | ```
171 |
172 | ```php
173 | get('products/attributes/1/terms')); ?>
174 | ```
175 |
176 | ```python
177 | print(wcapi.get("products/attributes/1/terms").json())
178 | ```
179 |
180 | ```ruby
181 | woocommerce.get("products/attributes/1/terms").parsed_response
182 | ```
183 |
184 | > JSON response example:
185 |
186 | ```json
187 | {
188 | "product_attribute_terms": [
189 | {
190 | "id": 18,
191 | "slug": "black",
192 | "name": "Black",
193 | "count": 5
194 | },
195 | {
196 | "id": 20,
197 | "slug": "blue",
198 | "name": "Blue",
199 | "count": 4
200 | },
201 | {
202 | "id": 19,
203 | "slug": "green",
204 | "name": "Green",
205 | "count": 4
206 | },
207 | {
208 | "id": 24,
209 | "slug": "pink",
210 | "name": "Pink",
211 | "count": 3
212 | },
213 | {
214 | "id": 22,
215 | "slug": "red",
216 | "name": "Red",
217 | "count": 3
218 | },
219 | {
220 | "id": 21,
221 | "slug": "white",
222 | "name": "White",
223 | "count": 3
224 | },
225 | {
226 | "id": 23,
227 | "slug": "yellow",
228 | "name": "Yellow",
229 | "count": 3
230 | }
231 | ]
232 | }
233 | ```
234 |
235 |
238 |
239 | ## Update a Product Attribute Term ##
240 |
241 | This API lets you make changes to a product attribute term.
242 |
243 | ### HTTP Request ###
244 |
245 |
246 |
247 | PUT
248 |
/wc-api/v3/products/attributes/<attribute_id>/terms/<id>
249 |
250 |
251 |
252 | ```shell
253 | curl -X PUT https://example.com/wc-api/v3/products/attributes/1/terms/18 \
254 | -u consumer_key:consumer_secret \
255 | -H "Content-Type: application/json" \
256 | -d '{
257 | "product_attribute_term": {
258 | "name": "BLACK"
259 | }
260 | }'
261 | ```
262 |
263 | ```javascript
264 | var data = {
265 | product_attribute_term: {
266 | name: 'BLACK'
267 | }
268 | };
269 |
270 | WooCommerce.put('products/attributes/1/terms/18', data, function(err, data, res) {
271 | console.log(res);
272 | });
273 | ```
274 |
275 | ```php
276 | [
279 | 'name' => 'BLACK'
280 | ]
281 | ];
282 |
283 | print_r($woocommerce->put('products/attributes/1/terms/18', $data));
284 | ?>
285 | ```
286 |
287 | ```python
288 | data = {
289 | "product_attribute_term": {
290 | "name": "BLACK"
291 | }
292 | }
293 |
294 | print(wcapi.put("products/attributes/1/terms/18", data).json())
295 | ```
296 |
297 | ```ruby
298 | data = {
299 | product_attribute_term: {
300 | name: "BLACK"
301 | }
302 | }
303 |
304 | woocommerce.put("products/attributes/1/terms/18", data).parsed_response
305 | ```
306 |
307 | > JSON response example:
308 |
309 | ```json
310 | {
311 | "product_attribute_term": {
312 | "id": 18,
313 | "name": "BLACK",
314 | "slug": "black",
315 | "count": 5
316 | }
317 | }
318 | ```
319 |
320 |
323 |
324 | ## Delete a Product Attribute Term ##
325 |
326 | This API helps you delete a product attribute term.
327 |
328 | ### HTTP Request ###
329 |
330 |
331 |
332 | DELETE
333 |
/wc-api/v3/products/attributes/<attribute_id>/terms/<id>
334 |
335 |
336 |
337 | ```shell
338 | curl -X DELETE https://example.com/wc-api/v3/products/attributes/1/terms/18 \
339 | -u consumer_key:consumer_secret
340 | ```
341 |
342 | ```javascript
343 | WooCommerce.delete('products/attributes/1/terms/18', function(err, data, res) {
344 | console.log(res);
345 | });
346 | ```
347 |
348 | ```php
349 | delete('products/attributes/1/terms/18')); ?>
350 | ```
351 |
352 | ```python
353 | print(wcapi.delete("products/attributes/1/terms/18").json())
354 | ```
355 |
356 | ```ruby
357 | woocommerce.delete("products/attributes/1/terms/18").parsed_response
358 | ```
359 |
360 | > JSON response example:
361 |
362 | ```json
363 | {
364 | "message": "Deleted product_attribute_term"
365 | }
366 | ```
367 |
368 |
371 |
--------------------------------------------------------------------------------
/source/includes/wp-api-v1/_order-notes.md:
--------------------------------------------------------------------------------
1 | # Order notes #
2 |
3 | The order notes API allows you to create, view, and delete individual order notes.
4 | Order notes are added by administrators and programmatically to store data about an order, or order events.
5 |
6 | ## Order note properties ##
7 |
8 | | Attribute | Type | Description |
9 | |-----------------|-----------|---------------------------------------------------------------------------------------------------------------------|
10 | | `id` | integer | Unique identifier for the resource. read-only |
11 | | `date_created` | date-time | The date the order note was created, in the site's timezone. read-only |
12 | | `note` | string | Order note. required |
13 | | `customer_note` | boolean | Shows/define if the note is only for reference or for the customer (the user will be notified). Default is `false`. |
14 |
15 | ## Create an order note ##
16 |
17 | This API helps you to create a new note for an order.
18 |
19 | ### HTTP request ###
20 |
21 |
22 |
23 | POST
24 |
/wp-json/wc/v1/orders/<id>/notes
25 |
26 |
27 |
28 | ```shell
29 | curl -X POST https://example.com/wp-json/wc/v1/orders/645/notes \
30 | -u consumer_key:consumer_secret \
31 | -H "Content-Type: application/json" \
32 | -d '{
33 | "note": "Order ok!!!"
34 | }'
35 | ```
36 |
37 | ```javascript
38 | const data = {
39 | note: "Order ok!!!"
40 | };
41 |
42 | WooCommerce.post("orders/645/notes", data)
43 | .then((response) => {
44 | console.log(response.data);
45 | })
46 | .catch((error) => {
47 | console.log(error.response.data);
48 | });
49 | ```
50 |
51 | ```php
52 | 'Order ok!!!'
55 | ];
56 |
57 | print_r($woocommerce->post('orders/645/notes', $data));
58 | ?>
59 | ```
60 |
61 | ```python
62 | data = {
63 | "note": "Order ok!!!"
64 | }
65 |
66 | print(wcapi.post("orders/645/notes", data).json())
67 | ```
68 |
69 | ```ruby
70 | data = {
71 | note: "Order ok!!!"
72 | }
73 |
74 | woocommerce.post("orders/645/notes", data).parsed_response
75 | ```
76 |
77 | > JSON response example:
78 |
79 | ```json
80 | {
81 | "id": 51,
82 | "date_created": "2016-05-13T20:51:55",
83 | "note": "Order ok!!!",
84 | "customer_note": false,
85 | "_links": {
86 | "self": [
87 | {
88 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes/51"
89 | }
90 | ],
91 | "collection": [
92 | {
93 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes"
94 | }
95 | ],
96 | "up": [
97 | {
98 | "href": "https://example.com/wp-json/wc/v1/orders/118"
99 | }
100 | ]
101 | }
102 | }
103 | ```
104 |
105 | ## Retrieve an order note ##
106 |
107 | This API lets you retrieve and view a specific note from an order.
108 |
109 | ### HTTP request ###
110 |
111 |
112 |
113 | GET
114 |
/wp-json/wc/v1/orders/<id>/notes/<note_id>
115 |
116 |
117 |
118 | ```shell
119 | curl https://example.com/wp-json/wc/v1/orders/645/notes/51 \
120 | -u consumer_key:consumer_secret
121 | ```
122 |
123 | ```javascript
124 | WooCommerce.get("orders/645/notes/51")
125 | .then((response) => {
126 | console.log(response.data);
127 | })
128 | .catch((error) => {
129 | console.log(error.response.data);
130 | });
131 | ```
132 |
133 | ```php
134 | get('orders/645/notes/51')); ?>
135 | ```
136 |
137 | ```python
138 | print(wcapi.get("orders/645/notes/51").json())
139 | ```
140 |
141 | ```ruby
142 | woocommerce.get("orders/645/notes/51").parsed_response
143 | ```
144 |
145 | > JSON response example:
146 |
147 | ```json
148 | {
149 | "id": 51,
150 | "date_created": "2016-05-13T20:51:55",
151 | "note": "Order ok!!!",
152 | "customer_note": false,
153 | "_links": {
154 | "self": [
155 | {
156 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes/51"
157 | }
158 | ],
159 | "collection": [
160 | {
161 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes"
162 | }
163 | ],
164 | "up": [
165 | {
166 | "href": "https://example.com/wp-json/wc/v1/orders/118"
167 | }
168 | ]
169 | }
170 | }
171 | ```
172 |
173 | ## List all order notes ##
174 |
175 | This API helps you to view all the notes from an order.
176 |
177 | ### HTTP request ###
178 |
179 |
180 |
181 | GET
182 |
/wp-json/wc/v1/orders/<id>/notes
183 |
184 |
185 |
186 | ```shell
187 | curl https://example.com/wp-json/wc/v1/orders/645/notes \
188 | -u consumer_key:consumer_secret
189 | ```
190 |
191 | ```javascript
192 | WooCommerce.get("orders/645/notes")
193 | .then((response) => {
194 | console.log(response.data);
195 | })
196 | .catch((error) => {
197 | console.log(error.response.data);
198 | });
199 | ```
200 |
201 | ```php
202 | get('orders/645/notes')); ?>
203 | ```
204 |
205 | ```python
206 | print(wcapi.get("orders/645/notes").json())
207 | ```
208 |
209 | ```ruby
210 | woocommerce.get("orders/645/notes").parsed_response
211 | ```
212 |
213 | > JSON response example:
214 |
215 | ```json
216 | [
217 | {
218 | "id": 51,
219 | "date_created": "2016-05-13T20:51:55",
220 | "note": "Order ok!!!",
221 | "customer_note": false,
222 | "_links": {
223 | "self": [
224 | {
225 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes/51"
226 | }
227 | ],
228 | "collection": [
229 | {
230 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes"
231 | }
232 | ],
233 | "up": [
234 | {
235 | "href": "https://example.com/wp-json/wc/v1/orders/118"
236 | }
237 | ]
238 | }
239 | },
240 | {
241 | "id": 46,
242 | "date_created": "2016-05-03T18:10:43",
243 | "note": "Order status changed from Pending Payment to Processing.",
244 | "customer_note": false,
245 | "_links": {
246 | "self": [
247 | {
248 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes/46"
249 | }
250 | ],
251 | "collection": [
252 | {
253 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes"
254 | }
255 | ],
256 | "up": [
257 | {
258 | "href": "https://example.com/wp-json/wc/v1/orders/118"
259 | }
260 | ]
261 | }
262 | }
263 | ]
264 | ```
265 |
266 | ## Delete an order note ##
267 |
268 | This API helps you delete an order note.
269 |
270 | ### HTTP request ###
271 |
272 |
273 |
274 | DELETE
275 |
/wp-json/wc/v1/orders/<id>/notes/<note_id>
276 |
277 |
278 |
279 | ```shell
280 | curl -X DELETE https://example.com/wp-json/wc/v1/orders/645/notes/51?force=true \
281 | -u consumer_key:consumer_secret
282 | ```
283 |
284 | ```javascript
285 | WooCommerce.delete("orders/645/notes/51", {
286 | force: true
287 | })
288 | .then((response) => {
289 | console.log(response.data);
290 | })
291 | .catch((error) => {
292 | console.log(error.response.data);
293 | });
294 | ```
295 |
296 | ```php
297 | delete('orders/645/notes/51', ['force' => true])); ?>
298 | ```
299 |
300 | ```python
301 | print(wcapi.delete("orders/645/notes/51", params={"force": True}).json())
302 | ```
303 |
304 | ```ruby
305 | woocommerce.delete("orders/645/notes/51", force: true).parsed_response
306 | ```
307 |
308 | > JSON response example:
309 |
310 | ```json
311 | {
312 | "id": 51,
313 | "date_created": "2016-05-13T20:51:55",
314 | "note": "Order ok!!!",
315 | "customer_note": false,
316 | "_links": {
317 | "self": [
318 | {
319 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes/51"
320 | }
321 | ],
322 | "collection": [
323 | {
324 | "href": "https://example.com/wp-json/wc/v1/orders/118/notes"
325 | }
326 | ],
327 | "up": [
328 | {
329 | "href": "https://example.com/wp-json/wc/v1/orders/118"
330 | }
331 | ]
332 | }
333 | }
334 | ```
335 | #### Available parameters ####
336 |
337 | | Parameter | Type | Description |
338 | |-----------|--------|---------------------------------------------------------------|
339 | | `force` | string | Required to be `true`, as resource does not support trashing. |
340 |
--------------------------------------------------------------------------------
/source/includes/v3/_product-shipping-classes.md:
--------------------------------------------------------------------------------
1 | # Product - Shipping Classes #
2 |
3 | This section lists all API endpoints that can be used to create, edit or otherwise manipulate product shipping classes.
4 |
5 | ## Product Shipping Class Properties ##
6 |
7 | | Attribute | Type | Description |
8 | | ------------- | ------- | ----------------------------------------------------------------------------------------------- |
9 | | `id` | integer | Shipping Class ID (term ID) read-only |
10 | | `name` | string | Shipping Class name required |
11 | | `slug` | string | Shipping Class slug |
12 | | `parent` | integer | Shipping Class parent |
13 | | `description` | string | Shipping Class description |
14 | | `count` | integer | Shows the quantity of products in this shipping class read-only |
15 |
16 | ## Create a Product Shipping Class ##
17 |
18 | This API helps you to create a new product shipping class.
19 |
20 | ### HTTP Request ###
21 |
22 |
23 |
24 | POST
25 |
/wc-api/v3/products/shipping_classes
26 |
27 |
28 |
29 | > Example of how to create a product shipping class:
30 |
31 | ```shell
32 | curl -X POST https://example.com/wc-api/v3/products/shipping_classes \
33 | -u consumer_key:consumer_secret \
34 | -H "Content-Type: application/json" \
35 | -d '{
36 | "product_shipping_class": {
37 | "name": "Priority"
38 | }
39 | }'
40 | ```
41 |
42 | ```javascript
43 | var data = {
44 | product_shipping_class: {
45 | name: 'Priority'
46 | }
47 | };
48 |
49 | WooCommerce.post('products/shipping_classes', data, function(err, data, res) {
50 | console.log(res);
51 | });
52 | ```
53 |
54 | ```php
55 | [
58 | 'name' => 'Priority'
59 | ]
60 | ];
61 |
62 | print_r($woocommerce->post('products/shipping_classes', $data));
63 | ?>
64 | ```
65 |
66 | ```python
67 | data = {
68 | "product_shipping_class": {
69 | "name": "Priority"
70 | }
71 | }
72 |
73 | print(wcapi.post("products/shipping_classes", data).json())
74 | ```
75 |
76 | ```ruby
77 | data = {
78 | product_shipping_class: {
79 | name: "Priority"
80 | }
81 | }
82 |
83 | woocommerce.post("products/shipping_classes", data).parsed_response
84 | ```
85 |
86 | > JSON response example:
87 |
88 | ```json
89 | {
90 | "product_shipping_class": {
91 | "id": 35,
92 | "name": "Priority",
93 | "slug": "priority",
94 | "parent": 0,
95 | "description": "",
96 | "count": 0
97 | }
98 | }
99 | ```
100 |
101 |
104 |
105 | ## View a Product Shipping Class ##
106 |
107 | This API lets you retrieve a product shipping class by ID.
108 |
109 |
110 |
111 | GET
112 |
/wc-api/v3/products/shipping_classes/<id>
113 |
114 |
115 |
116 | ```shell
117 | curl https://example.com/wc-api/v3/products/shipping_classes/35 \
118 | -u consumer_key:consumer_secret
119 | ```
120 |
121 | ```javascript
122 | WooCommerce.get('products/shipping_classes/35', function(err, data, res) {
123 | console.log(res);
124 | });
125 | ```
126 |
127 | ```php
128 | get('products/shipping_classes/35')); ?>
129 | ```
130 |
131 | ```python
132 | print(wcapi.get("products/shipping_classes/35").json())
133 | ```
134 |
135 | ```ruby
136 | woocommerce.get("products/shipping_classes/35").parsed_response
137 | ```
138 |
139 | > JSON response example:
140 |
141 | ```json
142 | {
143 | "product_shipping_class": {
144 | "id": 35,
145 | "name": "Priority",
146 | "slug": "priority",
147 | "parent": 0,
148 | "description": "",
149 | "count": 0
150 | }
151 | }
152 | ```
153 |
154 |
157 |
158 | ## View List of Product Shipping Classes ##
159 |
160 | This API lets you retrieve all product shipping classes.
161 |
162 |
163 |
164 | GET
165 |
/wc-api/v3/products/shipping_classes
166 |
167 |
168 |
169 | ```shell
170 | curl https://example.com/wc-api/v3/products/shipping_classes \
171 | -u consumer_key:consumer_secret
172 | ```
173 |
174 | ```javascript
175 | WooCommerce.get('products/shipping_classes', function(err, data, res) {
176 | console.log(res);
177 | });
178 | ```
179 |
180 | ```php
181 | get('products/shipping_classes')); ?>
182 | ```
183 |
184 | ```python
185 | print(wcapi.get("products/shipping_classes").json())
186 | ```
187 |
188 | ```ruby
189 | woocommerce.get("products/shipping_classes").parsed_response
190 | ```
191 |
192 | > JSON response example:
193 |
194 | ```json
195 | {
196 | "product_shipping_classes": [
197 | {
198 | "id": 30,
199 | "name": "Express",
200 | "slug": "express",
201 | "parent": 0,
202 | "description": "",
203 | "count": 1
204 | },
205 | {
206 | "id": 35,
207 | "name": "Priority",
208 | "slug": "priority",
209 | "parent": 0,
210 | "description": "",
211 | "count": 0
212 | }
213 | ]
214 | }
215 | ```
216 |
217 |
220 |
221 | ## Update a Product Shipping Class ##
222 |
223 | This API lets you make changes to a product shipping class.
224 |
225 | ### HTTP Request ###
226 |
227 |
228 |
229 | PUT
230 |
/wc-api/v3/products/shipping_classes/<id>
231 |
232 |
233 |
234 | ```shell
235 | curl -X PUT https://example.com/wc-api/v3/products/shipping_classes/35 \
236 | -u consumer_key:consumer_secret \
237 | -H "Content-Type: application/json" \
238 | -d '{
239 | "product_shipping_class": {
240 | "description": "Priority mail."
241 | }
242 | }'
243 | ```
244 |
245 | ```javascript
246 | var data = {
247 | product_shipping_class: {
248 | description: 'Priority mail.'
249 | }
250 | };
251 |
252 | WooCommerce.put('products/shipping_classes/35', data, function(err, data, res) {
253 | console.log(res);
254 | });
255 | ```
256 |
257 | ```php
258 | [
261 | 'description' => 'Priority mail.'
262 | ]
263 | ];
264 |
265 | print_r($woocommerce->put('products/shipping_classes/35', $data));
266 | ?>
267 | ```
268 |
269 | ```python
270 | data = {
271 | "product_shipping_class": {
272 | "description": "Priority mail."
273 | }
274 | }
275 |
276 | print(wcapi.put("products/shipping_classes/35", data).json())
277 | ```
278 |
279 | ```ruby
280 | data = {
281 | product_shipping_class: {
282 | description: "Priority mail."
283 | }
284 | }
285 |
286 | woocommerce.put("products/shipping_classes/35", data).parsed_response
287 | ```
288 |
289 | > JSON response example:
290 |
291 | ```json
292 | {
293 | "product_shipping_class": {
294 | "id": 35,
295 | "name": "Priority",
296 | "slug": "priority",
297 | "parent": 0,
298 | "description": "Priority mail.",
299 | "count": 0
300 | }
301 | }
302 | ```
303 |
304 |
307 |
308 | ## Delete a Product Shipping Class ##
309 |
310 | This API helps you delete a product shipping class.
311 |
312 | ### HTTP Request ###
313 |
314 |
315 |
316 | DELETE
317 |
/wc-api/v3/products/shipping_classes/<id>
318 |
319 |
320 |
321 | ```shell
322 | curl -X DELETE https://example.com/wc-api/v3/products/shipping_classes/35 \
323 | -u consumer_key:consumer_secret
324 | ```
325 |
326 | ```javascript
327 | WooCommerce.delete('products/shipping_classes/35', function(err, data, res) {
328 | console.log(res);
329 | });
330 | ```
331 |
332 | ```php
333 | delete('products/shipping_classes/35')); ?>
334 | ```
335 |
336 | ```python
337 | print(wcapi.delete("products/shipping_classes/35").json())
338 | ```
339 |
340 | ```ruby
341 | woocommerce.delete("products/shipping_classes/35").parsed_response
342 | ```
343 |
344 | > JSON response example:
345 |
346 | ```json
347 | {
348 | "message": "Deleted product_shipping_class"
349 | }
350 | ```
351 |
352 |
355 |
--------------------------------------------------------------------------------