setecg Posted June 21, 2022 Share Posted June 21, 2022 Hi! I'm trying to update the stock of the products via API/webservice. I can update the stock in a single-store Prestashop, and even in a multi-store prestashop I created for testing purposes. However I can update the stocks in a customer's shop. I can update any other product data but the stock. I will explain this with an specific example: There are two stores: one with ID=1 and another one with ID=4. The Webservice returns this product info.: https://myshop.com/api/products/999 In the obtained info, I see the stock_svailables node with this info: id = 12345 id_product_attribute = 0 id_shop_default = 4 So I can now get the stocks_available for that product: https://mitienda.com/api/stock_availables/12345 id_shop: 0 quantity: 4 etc... I don't understand why product.id_shop_default is 4 but stocks_available.id_shop is 0. However, I insist... So, if I want to modify the stock, I send this XML to stocks_available/12345: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <stock_available> <id>12345</id> <id_product>999</id_product> <id_product_attribute>0</id_product_attribute> <id_shop>0</id_shop> <id_shop_group></id_shop_group> <quantity>8</quantity> <depends_on_stock>0</depends_on_stock> <out_of_stock>2</out_of_stock> <location></location> </stock_available> </prestashop> I have tried specifying id_shop, id_group, or leaving them empty. Same result: product stock doesn't update. No error message in the request. Result is OK - 200 The request is executed correctly, but the stock in Prestashop is not changed. If I go ask for stocks_available/12345, I get something like 'there's not stocks_available for this product in this shop', and api/products/999 returns now an empty stocks_available node. I don't know if the problem is in my customer's Prestashop settings, or if he has products created in Shop 1 but stock in Shop 4, etc., but if I replicate this in my testing shop, I can update the stock with no problem. Dooes anybody know if I have to do something different when updating stock in multi-store? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now