Search code examples
shopwareshopware6shopware6-app

Shopware 6: How to forbid products with an app


Is it possible with a Shopware App (not a plugin!), to forbid certain products?

Example: I'm selling stuff with shipment in small stuff (DHL/UPS) and big stuff, with "your own truck" and I don't want to mix this in one order.

There is no event "product add to cart", so is there any possibility to throw an exception if the customer adds a certain product, based on the products already in the cart?


Solution

  • This should be doable with App Scripts. Here is the documentation about removing line items from the cart.

    https://developer.shopware.com/docs/guides/plugins/apps/app-scripts/cart-manipulation#remove-a-line-item