I’m building a custom app where I need to apply additional charges when a user marks a product as a Gift.
Here are the requirements:
Service Charge: A fixed $5 fee when the product is marked as a Gift.
Delivery Charge: A fixed $10 fee when the product is marked as a Gift.
So, both charges only apply if the product is purchased as a Gift.
I initially tried implementing this using a Discount Function along with the Shopify Function “Hide/Modify Shipping Rates”, but it’s not working as expected.
Currently, I’m unable to:
Add the fixed $10 delivery charge conditionally when the product is marked as a Gift.
Add the fixed $5 service charge directly to the cart.
What would be the best approach to implement this logic?
Hey @mukesh The approach I’d recommend here would be to actually model the fees as hidden, non-physical “fee” products (that are active, but not displayed on the storefront) and add/remove them programmatically when the buyer selects “Gift,” for example via Checkout UI Extensions cart changes at https://shopify.dev/docs/apps/checkout or via the Storefront API cart endpoints at https://shopify.dev/docs/api/storefront.
If the merchant requires the $10 to appear inside the shipping line item itself, the best approach is to use a custom shipping rate provider (CarrierService) to return rates that already include the surcharge when a “gift” attribute is present: carrierService - GraphQL Admin
Third‑party calculated shipping is required for CarrierService to work, so I just wanted to mention that as well. Hope this helps, let me know if I can clarify anything further on our end here.