I’m currently building an app and I’m planning on adding a feature that will automatically apply a discount to specific customers via a savedSearch. I’m achieving this by creating a PriceRule and an associated DiscountCode. I know similar questions have been asked in this forum, but I’m not seeing a very clear answer.
How would I go about automatically applying a discount code at checkout? Could I have a checkout/create webhook that then sends a checkout mutation with the discount code? Is it possible to apply a discount code to the cart?
I’ve seen answers involving DraftOrders. But I’m not completely sure about the differences between an order and a draft order.
In the 2019-07 version, you can create an automatic discount using our GraphQL mutation found here. If your app is a sales channel and is creating checkouts through the checkout API, you can programatically add discounts when creating checkouts. That said, it sounds like the above mutation would serve you better.
I have a follow-up question. A detail about the discount that I’m trying to apply is that it should only be valid for certain customers (identified by a tag). Can this automatic discount have specific customer conditions? I know that I can do this with discount codes so that’s what I’m currently using.
Hi, I am working on a similar thing with automatic discounts but when using the graphql mutation I am receiving this error.
Error: GraphQL error: Internal error. Looks like something went wrong on our end.
Request ID: 54284b8b-d710-4e94-b7a6-222318277275 (include this in support requests).