When the code for the shipping discount runs, it requests some data from Shopify.
What's important here is that it requests:
  • The list of "delivery groups." Each delivery group is a group of products that were in the cart, as well as a list of "delivery options."
For example, one of the delivery groups in this case contained the "Cat's Menu" product, and 2 delivery options - "Ermäßigter Versand" and "Versand von Tiefkühlware"
But for some reason that is currently unknown to me, this order actually contained 2 delivery groups
The 2nd delivery group contained the "Cat's Menu" product, and just the "Ermäßigter Versand" delivery option.
Since delivery options can often have the same name, Shopify gives each one a "handle" (it's like an ID) to distinguish from others.
In this case, there were 2 total "Ermäßigter Versand" delivery options, each with a different handle.
The way our app's shipping discounts work is that it goes through eevery delivery option within each delivery group, and figures out which discounts can be applied to that delivery option.
Because both of the "Ermäßigter Versand" delivery options were eligible, and had different handles, our app calculated a discount for each "Ermäßigter Versand" delivery option.
It's not clear why this leads to the discount applying twice, though, because the handles are unique, and only 1 delivery option can be chosen by the user at the time.
This is something I'm probably going to try to reach out to Shopify support about, because it's not documented anywhere and I've never seen this before