WooCommerce - Updating Product through API / HTTP Requests2019 Community Moderator ElectionProduct images distorted/too large in WooCommerceForce woocommerce product variable dropdownsMake a search only field for WooCommerce productsWoocommerce API - Requests from my own front-endWooCommerce REST API Setting Product Image - WooCommerce.NetPopulating, updating custom field in WooCommerce SubscriptionsHow enable/disable WooCommerce product variation using rest API (php)?Woocommerce user registration post requestWooCommerce WordPress Hook for Bulk Stock updatePOST & UPDATE JSON data in WooCommerce from external API
Why are there no stars visible in cislunar space?
What are the consequences of changing the number of hours in a day?
Does the Shadow Magic sorcerer's Eyes of the Dark feature work on all Darkness spells or just his/her own?
Emojional cryptic crossword
Animating wave motion in water
Help with identifying unique aircraft over NE Pennsylvania
Imaginary part of expression too difficult to calculate
Why doesn't the fusion process of the sun speed up?
Is xar preinstalled on macOS?
Which partition to make active?
Why is "la Gestapo" feminine?
If I cast the Enlarge/Reduce spell on an arrow, what weapon could it count as?
Why is participating in the European Parliamentary elections used as a threat?
Should a narrator ever describe things based on a characters view instead of fact?
PTIJ: Why do we make a Lulav holder?
What is the tangent at a sharp point on a curve?
Recursively updating the MLE as new observations stream in
How to read string as hex number in bash?
How to determine the greatest d orbital splitting?
How do you justify more code being written by following clean code practices?
Have the tides ever turned twice on any open problem?
Pre-Employment Background Check With Consent For Future Checks
Print last inputted byte
Output visual diagram of picture
WooCommerce - Updating Product through API / HTTP Requests
2019 Community Moderator ElectionProduct images distorted/too large in WooCommerceForce woocommerce product variable dropdownsMake a search only field for WooCommerce productsWoocommerce API - Requests from my own front-endWooCommerce REST API Setting Product Image - WooCommerce.NetPopulating, updating custom field in WooCommerce SubscriptionsHow enable/disable WooCommerce product variation using rest API (php)?Woocommerce user registration post requestWooCommerce WordPress Hook for Bulk Stock updatePOST & UPDATE JSON data in WooCommerce from external API
I am attempting to update WooCommerce products through notifications sent by a third party application. I have read the documentation on doing this and it seems easy enough, but it looks like the only way to use the API to update a product is by Product ID. Unfortunately, these are/were created incrementally while uploading the rather large product catalog into WooCommerce.
While making the .csv's and uploading to WooCommerce, we set the SKU's to be the same ID that the products have in the third-party software (book ISBN's). So I am able to send that number (the number that corresponds with SKU in WC) with the HTTP request, but that does not allow me to perform the product update.
It seems to me, the best way to accomplish this integration would be to change the product ID's of all my products in WooCommerce to be the same as this unique number that is currently the SKU. It doesn't appear as though this is possible to do in the dashboard or user interface, so I imagine I'll have to do it on a database level.
Does anyone know what tables will need to be modified or if there is a way to do this in the dashboard? Maybe even a tweak to my HTTP request to the API that will allow me to update by SKU?
woocommerce
add a comment |
I am attempting to update WooCommerce products through notifications sent by a third party application. I have read the documentation on doing this and it seems easy enough, but it looks like the only way to use the API to update a product is by Product ID. Unfortunately, these are/were created incrementally while uploading the rather large product catalog into WooCommerce.
While making the .csv's and uploading to WooCommerce, we set the SKU's to be the same ID that the products have in the third-party software (book ISBN's). So I am able to send that number (the number that corresponds with SKU in WC) with the HTTP request, but that does not allow me to perform the product update.
It seems to me, the best way to accomplish this integration would be to change the product ID's of all my products in WooCommerce to be the same as this unique number that is currently the SKU. It doesn't appear as though this is possible to do in the dashboard or user interface, so I imagine I'll have to do it on a database level.
Does anyone know what tables will need to be modified or if there is a way to do this in the dashboard? Maybe even a tweak to my HTTP request to the API that will allow me to update by SKU?
woocommerce
add a comment |
I am attempting to update WooCommerce products through notifications sent by a third party application. I have read the documentation on doing this and it seems easy enough, but it looks like the only way to use the API to update a product is by Product ID. Unfortunately, these are/were created incrementally while uploading the rather large product catalog into WooCommerce.
While making the .csv's and uploading to WooCommerce, we set the SKU's to be the same ID that the products have in the third-party software (book ISBN's). So I am able to send that number (the number that corresponds with SKU in WC) with the HTTP request, but that does not allow me to perform the product update.
It seems to me, the best way to accomplish this integration would be to change the product ID's of all my products in WooCommerce to be the same as this unique number that is currently the SKU. It doesn't appear as though this is possible to do in the dashboard or user interface, so I imagine I'll have to do it on a database level.
Does anyone know what tables will need to be modified or if there is a way to do this in the dashboard? Maybe even a tweak to my HTTP request to the API that will allow me to update by SKU?
woocommerce
I am attempting to update WooCommerce products through notifications sent by a third party application. I have read the documentation on doing this and it seems easy enough, but it looks like the only way to use the API to update a product is by Product ID. Unfortunately, these are/were created incrementally while uploading the rather large product catalog into WooCommerce.
While making the .csv's and uploading to WooCommerce, we set the SKU's to be the same ID that the products have in the third-party software (book ISBN's). So I am able to send that number (the number that corresponds with SKU in WC) with the HTTP request, but that does not allow me to perform the product update.
It seems to me, the best way to accomplish this integration would be to change the product ID's of all my products in WooCommerce to be the same as this unique number that is currently the SKU. It doesn't appear as though this is possible to do in the dashboard or user interface, so I imagine I'll have to do it on a database level.
Does anyone know what tables will need to be modified or if there is a way to do this in the dashboard? Maybe even a tweak to my HTTP request to the API that will allow me to update by SKU?
woocommerce
woocommerce
asked Mar 7 at 19:03
Case SilvaCase Silva
6812
6812
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Modifiy the Product IDs in the database directly is not a good choices.
This action is required to do every time when creating new products.
The most simplest and safe appoach is creating a new API,
which purpose for searching the product ID by SKU.
Here is a part of sample code.
function get_product_by_sku( $sku )
global $wpdb;
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
if ( $product_id ) return new WC_Product( $product_id );
return null;
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
add a comment |
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%2f55051068%2fwoocommerce-updating-product-through-api-http-requests%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Modifiy the Product IDs in the database directly is not a good choices.
This action is required to do every time when creating new products.
The most simplest and safe appoach is creating a new API,
which purpose for searching the product ID by SKU.
Here is a part of sample code.
function get_product_by_sku( $sku )
global $wpdb;
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
if ( $product_id ) return new WC_Product( $product_id );
return null;
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
add a comment |
Modifiy the Product IDs in the database directly is not a good choices.
This action is required to do every time when creating new products.
The most simplest and safe appoach is creating a new API,
which purpose for searching the product ID by SKU.
Here is a part of sample code.
function get_product_by_sku( $sku )
global $wpdb;
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
if ( $product_id ) return new WC_Product( $product_id );
return null;
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
add a comment |
Modifiy the Product IDs in the database directly is not a good choices.
This action is required to do every time when creating new products.
The most simplest and safe appoach is creating a new API,
which purpose for searching the product ID by SKU.
Here is a part of sample code.
function get_product_by_sku( $sku )
global $wpdb;
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
if ( $product_id ) return new WC_Product( $product_id );
return null;
Modifiy the Product IDs in the database directly is not a good choices.
This action is required to do every time when creating new products.
The most simplest and safe appoach is creating a new API,
which purpose for searching the product ID by SKU.
Here is a part of sample code.
function get_product_by_sku( $sku )
global $wpdb;
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
if ( $product_id ) return new WC_Product( $product_id );
return null;
answered Mar 7 at 19:45
L.C. Echo ChanL.C. Echo Chan
506925
506925
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
add a comment |
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
I'm not quite sure this would help me in my current situation, unless I'm confused. My third party application will be generating an http request on an action (such as a change in inventory quantities or a change in product pricing for example) and this will be sent to WooCommerce. The only relevant information I can send along to match the product will be the SKU number that I mentioned. Which is why I thought changing the ID would be the best option overall. It seems to me that in the future, when creating new products with .csv's, I can manually set the ID to match this number.
– Case Silva
Mar 7 at 19:49
add a comment |
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%2f55051068%2fwoocommerce-updating-product-through-api-http-requests%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