How to add meta_data to the a woocommerce customer
And I am trying to update a customer which requires a put request to the server. Here is the code to initialize woocomerece REST API:
var WooCommerceAPI = require('woocommerce-api');
var WooCommerce = new WooCommerceAPI(
url: 'http://example.com',
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
);
This is the code that updates customer:
var data =
"meta_data":[
"key": "stores",
"value": "food"
],
"first_name": "name"
WooCommerce.put('customers/5', data, function(err, data, res)
console.log(res);
);
the above code updates the customers "first_name" but does not add anything to the "meta_data" section of the customer. any Ideas as to why. Im guessing the php file does not update the meta data or is something wrong with my meta_data input format??? how can I update the meta_data of the customer. I have also tried using legacy woo versions (eg. 'wc/v2', 'wc/v1') but those don't even update the first_name.
php wordpress woocommerce woocommerce-rest-api
add a comment |
And I am trying to update a customer which requires a put request to the server. Here is the code to initialize woocomerece REST API:
var WooCommerceAPI = require('woocommerce-api');
var WooCommerce = new WooCommerceAPI(
url: 'http://example.com',
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
);
This is the code that updates customer:
var data =
"meta_data":[
"key": "stores",
"value": "food"
],
"first_name": "name"
WooCommerce.put('customers/5', data, function(err, data, res)
console.log(res);
);
the above code updates the customers "first_name" but does not add anything to the "meta_data" section of the customer. any Ideas as to why. Im guessing the php file does not update the meta data or is something wrong with my meta_data input format??? how can I update the meta_data of the customer. I have also tried using legacy woo versions (eg. 'wc/v2', 'wc/v1') but those don't even update the first_name.
php wordpress woocommerce woocommerce-rest-api
add a comment |
And I am trying to update a customer which requires a put request to the server. Here is the code to initialize woocomerece REST API:
var WooCommerceAPI = require('woocommerce-api');
var WooCommerce = new WooCommerceAPI(
url: 'http://example.com',
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
);
This is the code that updates customer:
var data =
"meta_data":[
"key": "stores",
"value": "food"
],
"first_name": "name"
WooCommerce.put('customers/5', data, function(err, data, res)
console.log(res);
);
the above code updates the customers "first_name" but does not add anything to the "meta_data" section of the customer. any Ideas as to why. Im guessing the php file does not update the meta data or is something wrong with my meta_data input format??? how can I update the meta_data of the customer. I have also tried using legacy woo versions (eg. 'wc/v2', 'wc/v1') but those don't even update the first_name.
php wordpress woocommerce woocommerce-rest-api
And I am trying to update a customer which requires a put request to the server. Here is the code to initialize woocomerece REST API:
var WooCommerceAPI = require('woocommerce-api');
var WooCommerce = new WooCommerceAPI(
url: 'http://example.com',
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
);
This is the code that updates customer:
var data =
"meta_data":[
"key": "stores",
"value": "food"
],
"first_name": "name"
WooCommerce.put('customers/5', data, function(err, data, res)
console.log(res);
);
the above code updates the customers "first_name" but does not add anything to the "meta_data" section of the customer. any Ideas as to why. Im guessing the php file does not update the meta data or is something wrong with my meta_data input format??? how can I update the meta_data of the customer. I have also tried using legacy woo versions (eg. 'wc/v2', 'wc/v1') but those don't even update the first_name.
php wordpress woocommerce woocommerce-rest-api
php wordpress woocommerce woocommerce-rest-api
asked Nov 12 '18 at 14:51
SuluuboiSuluuboi
205
205
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264650%2fhow-to-add-meta-data-to-the-a-woocommerce-customer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264650%2fhow-to-add-meta-data-to-the-a-woocommerce-customer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown