I’ve looked into this and presently this is not possible using the Orders API. In Storefront API, (checkoutDiscountCodeApplyV2 mutation would apply an existing discount to a checkout) - that’s seemingly the closest we’ve got to what you’re looking for.
It’s mentioned that Discounts can’t be applied to specific items within an Order in the Orders CSV docs strangely enough, I’ll look at getting this same mention into the API docs.
I’ve noted that there are other partners who are looking for the same functionality and I’ve made this known to the product team today. If there’s any future updates, they’ll be communicated via the Shopify Community forums and via our Developer Changelog. Hope that explains things at least!
If you are importing completed orders with the REST Admin API directly into a store then there wouldn’t be any checkout ID associated with it.
If you are looking to use the Storefront API to build a customer’s cart and apply discount codes, then your app should refer the customer to the checkout URL, where the Order will be created after their transaction is complete.
Hi, when we create and update a cart with the storefront API can we pass the processed_at date so the order is registered as when it took place in the past, since we are trying to import old orders into shopify, but the challenge is that old orders allowed for individual line_item discounts to be applied.