Manage discounts via Glue APIEdit on GitHub
The Promotions functionality enables sellers to 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 needs to fulfill certain discount conditions, for example, the purchase amount should exceed a certain threshold.
For more details on how to create the discount conditions, see Create discounts.
In your development, the Promotions API will help you to enable customers to redeem the benefits provided by promotions and check the correct order amount, 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 promotional items available for a cart.
- Add 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, first, they 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.
See Manage carts of registered users for details on how to retrieve promotional items for a registered user’s cart.
See Manage guest carts for details on how to retrieve promotional items for a guest user’s cart.
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 into your request.
See Retrieve discounts in carts of registered users for details on how to retrieve promotional items for a registered user’s cart.
See Retrieve discounts in guest carts for details on how to retrieve promotional items for a guest user’s cart.
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. Also, if a cart no longer fulfills the conditions of the promotion, all promotional products are removed automatically.
For submitting the form