Undocumented issue with free shipping discounts + fulfillment constraints

Hey team,

We’ve got a merchant whereby customers need to complete the order online instead of in Shopify POS while shopping in store because Shopify POS can’t (at this moment) support the visualisation of the customisations. Their online storefront can.

However, when a customer is in-store, and they complete the order online, we need to ensure that the order is fulfilled from the retail store. Currently, the merchant is using a Shopify Flow to change the location of the online order to the retail store. However, due to the migration to their new ERP, this needs to happen before the order lands in Shopify.

The reason is that the ERP (unfortunately) uses the orders/create and therefore the order lands in the ERP before the Shopify Flow has run.

We wanted to use a fulfillment constraint + metafield to ensure that when discount code X is applied, it needs to be fulfilled from location Y. This mapping would be stored in a metafield on the discount, and should be supported according to the documentation ([see here](Fulfillment Constraints Function API)).

However, we found that discount applications aren’t showing up in the fulfillment constraints at all. We’ve tried all discounts, but none of the discounts show up in the discount applications for the fulfillment constraint input.

NB: We’ve also tried to access the discount applications through the delivery groups, but those don’t return any results either: Fulfillment Constraints Function API .

The app does have read_discounts and write_discounts as part of it’s access scopes.

Is this a bug or incorrect documentation?

Hmm, I might have been to quick here. It’s documented, but not very clearly. It’s hidden here: Function APIs .

The discount API’s don’t run until the end, and the Fulfillment Constraint runs before. It seems we’ve got no other choice than to revise our logic.