Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

available quantity not checked on PUT item to cart #720

@DennisdeBest

Description

@DennisdeBest

Hello,

When I try to add a product with a bigger quantity than is available (POST ​/carts​/{token}​/items) I get the following response :

{"code":500,"message":"Not enough stock for product variant: my_product"}

That is great but when I update the quantity of the product, PUT /carts/{token}/items/{identifier} it always passes even if the quantity is much higher than the available stock.

Looking into vendor/sylius/shop-api-plugin/src/Controller/Cart/ChangeItemQuantityAction.php I can see tht it is the validate function fron the DefaultCommandProvider that is called. There are no constraints passed to this function. What could we do to check the inventory when the quantity gets changed ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions