Example · Exceptions

Some things do not come back, and the customer sees why.

Opened in-ear headphones, a cushion cover with an embroidered monogram, a sewing guide as a PDF. Those products stand visibly in the form, but greyed out with a sentence below, instead of silently missing.

The question

How do I keep single products and whole groups of products out of returns without customers wondering?

The situation

A shop for home and technology sells off-the-peg cushion covers, the same with a monogram on request, in-ear headphones and sewing guides to download. The monogram covers all have product numbers starting with “MONO-”, there are more than 80.

  • In-Ear Headphones Pure (RS-3008): excluded for reasons of hygiene, a single product
  • Cushion covers with monogram: every number starts with “MONO-”, more than 80 variants
  • Sewing guide as PDF: a digital product

What the customer sees in the form

Every position stands there, only those that may go back can be chosen

A customer has all four products in one order. The form “New return” lists every position; whatever does not go back stands grey with quantity 0 and a sentence below the name.

  • The off-the-peg cushion cover can be chosen, with “2 possible” and its price.

  • The in-ear headphones carry “Excluded from returns.”, because the custom field is set at the product.

  • The cushion cover with monogram carries the same sentence, here the Twig rule excludes it.

  • The sewing guide is a download and never goes back; nobody has to set that.

Three levels: by itself, at the product, by rule

Level 1: what does not go back by itself

Only standard products of Shopware and sets of the set configurator go back. Everything else stays grey in the form without you setting anything.

  • digital products: “Download, can not be sent back.”
  • a bought return label: “Label, can not be sent back.”
  • discounts, vouchers, credits, free positions and b-stock: “Can not be sent back.”

Level 2: a single product through the custom field

For the in-ear headphones one switch at the product is enough. On installation the plugin creates the set “Return shipment” with the field “Exclude from return shipments”; variants inherit the value from the main product.

  • Open the set Return shipment at the product, switch on Exclude from return shipments and save.

Level 3: many products through a Twig rule

Switching more than 80 monogram variants one by one would be tedious. In the card “Requirements for products (Twig)” an expression checks every position of the order; {% set isValid = false %} excludes it. One line is enough for the monograms: {% if lineItem.product and lineItem.product.productNumber starts with 'MONO-' %}{% set isValid = false %}{% endif %}.

What the expression knows:

  • lineItem, the position of the order with its quantity,
  • lineItem.product, the product with number, custom fields and properties,
  • lineItem.order, the order, for example for single order numbers.

And if the team makes an exception after all?

In the window “Create return shipment” in the admin excluded products stand with “excluded for customers” and a blue notice; the team can take them back anyway, for example for a defect. Downloads and bought labels do not go there either. More under Creating in the admin.

The settings for it

Where to find them in the configuration (Orders › Return shipments › side menu System › Settings):

  • Card Requirements for products (Twig) › Check products with TwigChecks every position with the expression below: in the shop a position left out cannot go back, in the window "Create return shipment" of the administration it shows with a notice. A faulty expression makes both stop with an error; try it on a test order first.

  • Card Requirements for products (Twig) › Twig expressionRuns for every position of the order, with {{ lineItem }} (the position from "order_line_item"), {{ lineItem.product }} (the product) and {{ lineItem.order }} (the order). {% set isValid = false %} leaves the position out. Example: {% if lineItem.product and lineItem.product.productNumber == 'abc-12345' %}{% set isValid = false %}{% endif %}

Common questions

How do I exclude a single product from returns?

Switch on “Exclude from return shipments” in the set “Return shipment” of the custom fields at the product. Variants inherit it from the main product.

Do customers see excluded products at all?

Yes. They stand grey in the form with quantity 0 and the sentence “Excluded from returns.”, so that nobody thinks the product is missing by mistake.

Can I exclude whole categories or number ranges?

Yes, with the Twig expression in the card “Requirements for products (Twig)”. It runs for every position and knows product, position and order, so also product numbers, custom fields and properties.

Do I have to exclude downloads myself?

No. Digital products, bought labels, discounts, vouchers and b-stock do not go back by themselves.

What happens with an error in the Twig expression?

The check stops with an error, in the shop as in the admin. So test a new rule with a test order before you switch it on.

Can the team still take back an excluded product?

Yes. In the admin the exclusion is only a notice; the window “Create return shipment” takes the product anyway. Downloads and bought labels stay blocked there as well.

Try it in the demo shop.

The demo shop shows the customer account and the administration fully set up. The manual shows every setting.