Maybe you are not observing the column name for the stock. Please paste here the column name in the CSV file for the product you are importing.
We only used csv to assign multiple locations for products.
For stock updates, we are trying to use the API
API endpoints are clear, so that method will work for sure but CSV import require correct meta keys to be updated against the product IDs.
Here is the csv header used https://paste.pics/d8a189bee877caf438ff62cf9e8321d1
Anything else needed to be updated?
I don’t understand it exactly, I think you should export a file first having location selected, stock values entered so you can see the relevant column names exported. That would help you to understand what needs to import.
Sorry for any confusion. Let me rephrase.
We have a few products for which we get the positive/correct API response and, for some products we see random digits (as mentioned in op) as API response.
i am really not getting it
Can you tell me which meta key is required for the csv column to update the stock?
Meta key name varies according to the location ID for each product, kindly try an export first and see the column names (meta_keys) actually used for the stock value against each product.
Hi
Here is an exported csv file to see how much stock is available for different locations.
Now, when we use API to set the stock value to any particular location using as follows: https://paste.pics/7d16af8333dbff06953d16fa765e6b2e
We see this type of response for both locations shown above: https://paste.pics/2d2df6defdaefda887dad5fa8cd09c8b
When we see such response – the stock for specified location don’t update.
Please note that: we do not want to use CSV to upload the stock for each location because, we want to pull stock data from our erp and push that every hour to the woocommerce using your plugin.
Does this clarify further on issue we facing?
Dear Tushar,
I have tested it, everything is working as expected. Kindly check your end again.
https://youtu.be/8XluFJbttsQ
Thank you for taking time & sharing the test.
However, in our case – true
response shows up randomly for one of the locations but 99% of the time, the response shows either as false
or as random digit numbers.
Based on your test result, I did the following.
- Unchecked stock locations assigned for the
sku: 935
- Reduced stock to
0
- Re-assigned locations and updated the product, manage stock = yes
- Stock for all locations is now
0
- Updated the product
- Ran the following for 3443, 3436 and 3433 using location IDs and SKU:
?slw-api&id=935&stock_value=10&action=set&item=stock&format=json&product_id=935&location_id=3443
- Result: for all three attempts, the result was
{"response":false}
- Ran the following for 3443, 3436 and 3433 using location IDs and Product ID (not SKU):
?slw-api&id=537&stock_value=10&action=set&item=stock&format=json&product_id=537&location_id=3443
- Result: for all three attempts, the result was
{"response":true}
It’s working when using product id and not working using sku
But SKU wasn’t mentioned anywhere in the plugin API/Developers section, why are you trying SKU? This thread topic should be changed to the following “API endpoints are not working with SKU instead of ID”, Tushar, seriously it was a kind of experiment or a new feature request but not the bug report. You know why ID and product_id two parameters are given? Because sometimes when we update a variable product so ID would be variation ID and product_id will remain the product_id. Excuse me.