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.