-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Inventory] Decrease quantity of items when order is paid #5935
Conversation
GSadee
commented
Aug 31, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Related tickets | #5870 |
License | MIT |
{ | ||
$indexOfVariant = $product->getVariants()->indexOf($variant); | ||
$product->getVariants()->get($indexOfVariant)->setTracked(true); | ||
$product->getVariants()->get($indexOfVariant)->setOnHand($quantity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use already existing transformer to obtain specific variant of a specific product. Then we can simply do:
$variant->setTracted(true);
$variant->setOnHand($quantity);
3f124e9
to
804c13d
Compare
804c13d
to
677233f
Compare
*/ | ||
public function theCustomerBoughtSeveralProducts($quantity, ProductInterface $product) | ||
{ | ||
$this->addProductVariantToOrder($this->variantResolver->getVariant($product), $product->getPrice(), $quantity); | ||
$variant = $this->variantResolver->getVariant($product); | ||
$this->addProductVariantToOrder($variant, $product->getPrice(), $quantity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$product->getPrice()
-> $variant->getPrice()
Thank you Ania and Grzegorz! Please apply my comments in a separate PR. |
And the product "T-shirt banana" has "Yellow" variant priced at "€20.54" | ||
And the product "T-shirt banana" has "Green" variant priced at "€5.54" | ||
And there are 5 items of "Yellow" variant of product "T-shirt banana" available in the inventory | ||
And there are 5 items of "Green" variant of product "T-shirt banana" available in the inventory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...there are 5 units items... (see #5934)
[Inventory] Decrease quantity of items when order is paid