Skip to content

Conversation

@Wiggee11
Copy link
Contributor

@Wiggee11 Wiggee11 commented Jun 12, 2024

Description

_productService.GetProductStock() does not have a method accepting a single argument, so updated to use _productService.GetProductStock(evt.Order.StoreId, productReference) - include storeId.

AddProduct handlers was also checking orderlines for quantity but orderlines are empty, and checking stock value incorrectly.

Product & version (if relevant)

Umbraco 13.3.0
Umbraco.Commerce 13.1.1

Wiggee11 added 3 commits June 12, 2024 12:16
`_productService.GetProductStock()` does not have a method accepting a single argument, so updated to use `_productService.GetProductStock(evt.Order.StoreId, productReference)` storeId and productReference
OrderLines are empty on an OrderProductAdd event so you can simply use the order.Quantity value.

Also updated the stock check to fail IF quantity greater than stock (remove equal to)
@Wiggee11
Copy link
Contributor Author

When adding a product to a new order/cart, the OrderLines are empty so you will need to use the evt.Quantity value.

If an order/cart already exists and you are adding a product then the OrderLines do exist.

@eshanrnh
Copy link
Contributor

Thanks, @Wiggee11 for the PR 🙌 We will take a look as soon as we can 🙂

Copy link
Contributor

@eshanrnh eshanrnh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes looks good to me. 🙌 Indeed, the GetProductStock method requires 2 arguments.

Thanks for updating the code.

@eshanrnh eshanrnh merged commit 6492be4 into umbraco:main Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants