We process subscription orders using Recharge. Every month, we want to send customers a free sample with their order. So that our warehouse team know what to pack and when, we want to run a background job that will loop through subscription orders as they come in, and modify them to include the free sample item.
When doing so, the sample item should not be charged to the customer, and ideally we would like to add a custom attribute to the line item for record-keeping (.e.g _free_sample
).
I had a look at the documentation here, and have a few questions:
- I think we need to use the
orderEditAddVariant
mutation. If we use this, can I just confirm that the customer will not be charged? I ask as it doesn’t look like we can override the amount (in the event the free sample might be sold on our site as an actual product). If the customer is charged, is the solution to apply a discount usingorderEditAddLineItemDiscount
? - Alternatively, we could use
orderEditAddCustomItem
– where it looks like we can set a price of 0. However, it doesn’t look like we can link this to a product / variant, which has implications for inventory management among other things. - It doesn’t look like either of these methods allows for custom attributes to be set. Is this indeed the case, and if so, is there any workaround? I guess we could cancel and recreate the order with the new line items, but this seems fairly cumbersome.
Any advice would be greatly appreciated, thank you in advance.