Design a Discount and Coupon Engine

Medium · Low-Level Design · about 40 minutes

Asked at Shopify, Amazon, Instacart, eBay, Walmart Global Tech, Wayfair, Etsy, Shopee, Flipkart, Zalando.

Design the discount engine for a shopping cart. Promotions include percentage off a category, buy-X-get-Y, a fixed amount off orders over a threshold, and single-use coupon codes. Given a cart, return the final price with one line per discount applied. Some promotions can stack and some can't.

Related guides