kiplingi
kiplingi

Reputation: 66

Shopware 6 Apps - How can I change the price for a cart line item

I search for a solution for a Shopware app, similar to this. The price depends on user input, so it will have to be calculated after a product is added to the cart.


EDIT

I tried to solve it via cart scripts, but you cannot create a calculatedPrice only a priceCollection via the cart service. Further, getting the necessary data is not really possible.

My other thought was using the api, but there is no endpoint which can manipulate the cart, only the finished order.

Upvotes: 2

Views: 757

Answers (1)

dneustadt
dneustadt

Reputation: 13161

Using app scripts it is only possible to add/remove products/discounts/surcharges to or from the cart. As you already noted, you can't manipulate the resulting line items, so exchanging the price is not a possibility at the moment. If the user inputs would result in pre-set prices, you could make use of advanced prices in combination with your own custom rule conditions. Otherwise, using apps, all you could do at the moment would be to calculate a single discount/surcharge based on all the line items in the cart. That way you could at least manipulate the total price of the cart freely.

Upvotes: 1

Related Questions