Sylius: How to update product qty programmatically

Created on 7 Apr 2017  ·  4Comments  ·  Source: Sylius/Sylius

Hello,

I'm doing QuickBooks integration. How do I update an available product qty. For example I receive from QB that we have 50 products I want to use something like $product->setQty(50)
Please, help.
Thanks!

Documentation

All 4 comments

What you need here is probably the onHand value of the ProductVariant, that is tracked in the inventory.

Read more on inventory in Sylius here.

So the only thing I need to do is $productVariant->setOnHand(50)?

@alexdrupal Yes! And flush the manager of course.

Please reopen if still an issue. @TheMadeleine Maybe we should add this to http://docs.sylius.org/en/latest/book/products/inventory.html? Just example of setting the onHand.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javiereguiluz picture javiereguiluz  ·  3Comments

ping86 picture ping86  ·  3Comments

Chrysweel picture Chrysweel  ·  3Comments

hmonglee picture hmonglee  ·  3Comments

eb22fbb4 picture eb22fbb4  ·  3Comments