Glue API: Manage discounts via Glue APIEdit on GitHub
The Promotions functionality lets sellers provide a promotional item that the customers can add to their carts at a discounted price or even for free. To be eligible for promotions, the purchase must fulfill certain discount conditions—for example, the purchase amount exceeding a certain threshold.
For more details about how to create the discount conditions, see Create discounts.
In your development, the Promotions API helps you to allow customers to redeem the benefits provided by promotions and check the correct order amount with the discount included.
For detailed information on the modules that provide the API functionality and related installation instructions, see Glue API: Promotions & Discounts Feature Integration.
Managing promotional items
You can do the following actions on the promotional items via API:
- Retrieve the promotional items available for a cart.
- Add any applicable promotional items to cart.
- Remove the added promotional items from cart.
Retrieving promotional items available for cart
For customers to be able to benefit from promotional offers, they first need to know about them. For this purpose, you can fetch the promotions available for products in a cart and display the possible benefits to the customer. To do so, you can query the cart information and include the
promotional-items resource relationship. The response provides the abstract SKU of the promoted product and how many of the promotional items customers can add. To present detailed information on promotional products to the customer, you can include the
concrete-products resource relationships.
For details about how to retrieve promotional items for a registered user’s cart, see Manage carts of registered users.
For details about how to retrieve promotional items for a guest user’s cart, see Manage guest carts.
Adding applicable promotional items to cart
Once you know what promotional items you can make use of, you can apply the discounts by adding the promotional items to cart. To retrieve details on cart rules of the promotional items you add, include the cart-rule resource relationship in your request.
For details about how to retrieve promotional items for a registered user’s cart, see Retrieve discounts in carts of registered users.
For details about how to retrieve promotional items for a guest user’s cart, see Retrieve discounts in guest carts.
Removing promotional items from cart
To remove a discount applied to a promotional product, remove the promotional product(s) from the cart. For details, see Removing Items in Manage items in carts of registered users and Manage guest cart items. If a cart no longer fulfills the conditions of the promotion, all promotional products are removed automatically.
For submitting the form