Free gift missing from Facebook & Instagram Shop orders that go directly to Shopify checkout

Hi Shopify Community,

Our store adds a free gift when an eligible cart reaches the purchase threshold. This currently works through custom theme JavaScript on our online store.

We received an eligible order through the Facebook & Instagram sales channel with no free gift. It appears the customer added the product within Facebook/Instagram Shop and was sent directly to Shopify checkout, without loading our product or cart pages. If so, our theme JavaScript would never run.

We need the gift to appear in checkout before the customer pays, not be added manually or through a post-order edit. We also need to avoid adding a second gift when our theme has already added one.
I have also set shopify discount so it can trigger.

Hey @Riddhi_Dev - thanks for reaching out.

I did some digging here and I’ll share my findings below:

To start, Shopify Functions don’t currently provide a general operation to insert an independent gift line. There’s an existing feature request covering this gap, but no release timeline to share.

The available approaches have limits:

  • Checkout UI extension (Shopify Plus only): can add the gift before payment when cart changes are permitted, but cart changes aren’t available with accelerated methods such as Apple Pay or Google Pay. API details
  • Cart Transform (lineExapand): can bundle a gift with a purchased product, but the gift quantity scales with the purchased line’s quantity. Other developers have encountered this when trying to limit gifts to one per order. Related discussion

For Functions, public App Store apps can serve non-Plus stores, while custom apps require Plus.

I don’t have a confirmed solution that covers all of the requirements you’ve outlined, but I can add your use case to the existing feature request.

I hope this helps and let me know if you have any further questions.