Jump to content

Prestashop 1.7 API Stock Synchronization

Recommended Posts

Good Day

I would like to know where I can edit the API PHP code to send requests for updated stock levels from my supplier.

I have read the Prestashop Webservices tutorial and know how to create access to the Webservice, and have also got the code and setup instructions from my supplier.

All I need to know now is where to put the code to send the requests, and if there is any additional code that I need to insert to send regular requests for updated stock levels, as I would like this update to be synchronized with the stock levels of my supplier.

Your help in this regard will be greatly appreciated.

Thank You

Share this post

Link to post
Share on other sites


Right now i have a situation  close to your problem, where i need to check the supplier quantity for a product before a customer can add the product to cart. The issue is that i have two separate quantities for a product, my own and supplier 'probable' quantity.

I see two solutions here:

I need a second check for the available quantity of products that the customer want to add to it's cart through an API, in addition to internal prestashop stock.

For example, "Allow ordering of out-of-stock products" is set to NO. If the stock quantity of the given product is 250 and the customer inputs 250, all is good. If the input is 251, prestashop automatically disable the "Add to cart" button.

Additionally, in this checking, if my API returns 200, when the customer types 250 in quantity box, the message "there are not enough products in stock" should appear and "add to cart" button is disabled.

Or the second solution: use two warehouses, one is for my own quantity and the second one is the supplier quantity. But i need to constantly update the supplier warehouse with a cron for valid quantities and i don't know if i can do this with the Webservice.

How did you find a solution for your problem?

Thank you

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More