OrderServices.add#OrderProductQuantity Service with negative Change in Quantity

In mantle.order.OrderServices there is a service called add#OrderProductQuantity. I am using it to add a product quantity to an order. In that service, there is a parameter for quantity, and if the addToQuantity parameter is true (it is by default) then the quantity parameter is used as a way to add a change in product item quantity rather than a new item product item quantity.

I currently have an application that has a store cart that looks like this:

The - button subtracts from the product item quantity in an order and the + button adds one. I’m currently using the add#OrderProductQuantity service’s quantity parameter for this, however it doesn’t currently allow a quantity below 0 see here.

Is changing that service to allow a negative change in quantity an acceptable change for that service? I feel like it makes sense in this context and would be helpful to other people, although I don’t know what the purpose of making the quantity below 0 just delete the OrderItem (if it exists) rather than allowing it to be modified.

@jonesde What do you think?

The add#OrderProductQuantity service is meant for add to cart sorts of forms rather than edit cart sorts of forms where a quantity is specified to set rather than a quantity to add.

For the different semantics of setting a quantity (vs adding) the update#OrderItem service is the one to use.

1 Like


That makes sense.