diff --git a/docs/6-ecom-solution-enhancement/02-dod-for-practical-tasks.md b/docs/6-ecom-solution-enhancement/02-dod-for-practical-tasks.md index 2271080..0306ab9 100644 --- a/docs/6-ecom-solution-enhancement/02-dod-for-practical-tasks.md +++ b/docs/6-ecom-solution-enhancement/02-dod-for-practical-tasks.md @@ -5,4 +5,5 @@ sidebar_position: 2 # 6.2 Definition of Done for Practical Tasks * Promotions are created according to the provided scenarios. +* The BFF component is enhanced to support discounts on the Storefront. * The BFF component is enhanced to provide order list information to the Storefront. \ No newline at end of file diff --git a/docs/6-ecom-solution-enhancement/03-practical-task-1-promotions.mdx b/docs/6-ecom-solution-enhancement/03-practical-task-1-promotions.mdx index e49b89f..d522f25 100644 --- a/docs/6-ecom-solution-enhancement/03-practical-task-1-promotions.mdx +++ b/docs/6-ecom-solution-enhancement/03-practical-task-1-promotions.mdx @@ -2,35 +2,93 @@ sidebar_position: 3 --- +import { Highlight } from '/src/components/Shared'; + # 6.3 Practical Task - Promotions ## What is this task about This task involves configuring various promotion conditions in Commercetools to enhance the shopping experience for customers. +Additionally the task involves modifying the Backend For Frontend (BFF) logic to enable promotions functionality on the Storefront. ## What should be done -You will create various promotions for several real-world scenarios in Commercetools. +* Commercetools: You will create various promotions for several real-world scenarios. +* BFF: Implement possibility to apply promotions and extend Cart response to include discount information. ## Task -1. **Percentage Discount on Cart Items.** -As a customer, I want to receive a 10% discount on my entire cart when I apply the code "SAVE10", so that I can save money on my purchase. +1. Create following promotions in Commercetools: + + 1.1. **Percentage Discount on Cart Items.** + As a customer, I want to receive a 10% discount on my entire cart when I apply the code "SAVE10", so that I can save money on my purchase. +
+ ![promotions-cart-discount-save10-1.png](assets/promotions-cart-discount-save10-1.png) + ![promotions-cart-discount-save10-2.png](assets/promotions-cart-discount-save10-2.png) +
+ + 1.2. **Fixed Amount Discount on Specific Products.** + As a store administrator, I want to create a promotion where customers get a $20 discount on a specific product when they buy two or more units, so that I can boost sales for that particular product. +
+ ![promotions-cart-discount-quantity-greater-than-1.png](assets/promotions-cart-discount-quantity-greater-than-1.png) + ![promotions-cart-discount-quantity-greater-than-2.png](assets/promotions-cart-discount-quantity-greater-than-2.png) +
+ + + 1.3. **Buy One, Get One (BOGO) Free.** + As a customer, I want to be eligible for a "Buy One, Get One Free" promotion on selected items in my cart, so that I can get additional products at no extra cost. +
+ ![promotions-BOGO.png](assets/promotions-BOGO.png) +
+ + 1.4. **Tiered Discount on Order Total.** + As a customer, I want to receive a 5% discount on my order total when it reaches $100, and a 10% discount when it reaches $200, so that I can save money on larger purchases. +
+ ![promotions-tired-discount-1.png](assets/promotions-tired-discount-1.png) + ![promotions-tired-discount-2.png](assets/promotions-tired-discount-2.png) +
+ + 1.5. **Exclusive Customer Group Discount.** + As a store administrator, I want to create a special discount for VIP customers, providing them with a 15% discount on all products, so that I can reward and retain loyal customers. +
+ ![promotions-vip-customers.png](assets/promotions-vip-customers.png) +
+ + 1.6. **Free Shipping Threshold.** + As a customer, I want to qualify for free shipping when my order total reaches $50, so that I can avoid additional shipping costs. +
+ ![promotions-free-shipping.png](assets/promotions-free-shipping.png) +
+ + + 1.7. **Product Bundle Discount.** + As a customer, I want to receive a discount when I buy a predefined bundle of products, so that I can save money on purchasing them together. +
+ ![promotions-bundle-1.png](assets/promotions-bundle-1.png) + ![promotions-bundle-2.png](assets/promotions-bundle-2.png) +
-2. **Fixed Amount Discount on Specific Products.** -As a store administrator, I want to create a promotion where customers get a $20 discount on a specific product when they buy two or more units, so that I can boost sales for that particular product. -3. **Buy One, Get One (BOGO) Free.** -As a customer, I want to be eligible for a "Buy One, Get One Free" promotion on selected items in my cart, so that I can get additional products at no extra cost. +2. Extend BFF Cart response to support product discount. Response must contain discounted price. This discounted price will allow user to see both basic price and discounted price on UI. Please refer to request **Get Cart** in the [StoreFront Postman Collection](https://github.com/EPAM-JS-Competency-center/camp-storefront-nuxt/tree/main/postman) to find example of the request and response. -4. **Tiered Discount on Order Total.** -As a customer, I want to receive a 5% discount on my order total when it reaches $100, and a 10% discount when it reaches $200, so that I can save money on larger purchases. +3. Extend BFF Cart update API to support functionality that allows to apply promotions. Please refer to request **Put Cart / AddDiscountCode** in the [StoreFront Postman Collection](https://github.com/EPAM-JS-Competency-center/camp-storefront-nuxt/tree/main/postman) to find example of the request and response. -5. **Exclusive Customer Group Discount.** -As a store administrator, I want to create a special discount for VIP customers, providing them with a 15% discount on all products, so that I can reward and retain loyal customers. +## Commercetools API -6. **Free Shipping Threshold.** -As a customer, I want to qualify for free shipping when my order total reaches $50, so that I can avoid additional shipping costs. +### Cart +#### Get Cart by id +##### GET `{{host}}/{{project-key}}/carts/{{cart-id}}` -7. **Product Bundle Discount.** -As a customer, I want to receive a discount when I buy a predefined bundle of products, so that I can save money on purchasing them together. +#### Add discount code +##### POST `{{host}}/{{project-key}}/carts/{{cart-id}}` +```jsx title="Request Body" +{ + "version": {{cart-version}}, + "actions": [ + { + "action" : "addDiscountCode", + "code" : "mydiscountcode", + } + ] +} +``` \ No newline at end of file diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-BOGO.png b/docs/6-ecom-solution-enhancement/assets/promotions-BOGO.png new file mode 100644 index 0000000..fbe88ce Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-BOGO.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-bundle-1.png b/docs/6-ecom-solution-enhancement/assets/promotions-bundle-1.png new file mode 100644 index 0000000..219f599 Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-bundle-1.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-bundle-2.png b/docs/6-ecom-solution-enhancement/assets/promotions-bundle-2.png new file mode 100644 index 0000000..4fcc622 Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-bundle-2.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-quantity-greater-than-1.png b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-quantity-greater-than-1.png new file mode 100644 index 0000000..b7103ad Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-quantity-greater-than-1.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-quantity-greater-than-2.png b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-quantity-greater-than-2.png new file mode 100644 index 0000000..19cbab4 Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-quantity-greater-than-2.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-save10-1.png b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-save10-1.png new file mode 100644 index 0000000..423e117 Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-save10-1.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-save10-2.png b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-save10-2.png new file mode 100644 index 0000000..3b7f4de Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-cart-discount-save10-2.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-free-shipping.png b/docs/6-ecom-solution-enhancement/assets/promotions-free-shipping.png new file mode 100644 index 0000000..fa7ee0e Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-free-shipping.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-tired-discount-1.png b/docs/6-ecom-solution-enhancement/assets/promotions-tired-discount-1.png new file mode 100644 index 0000000..1b4cbda Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-tired-discount-1.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-tired-discount-2.png b/docs/6-ecom-solution-enhancement/assets/promotions-tired-discount-2.png new file mode 100644 index 0000000..693d822 Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-tired-discount-2.png differ diff --git a/docs/6-ecom-solution-enhancement/assets/promotions-vip-customers.png b/docs/6-ecom-solution-enhancement/assets/promotions-vip-customers.png new file mode 100644 index 0000000..f08b626 Binary files /dev/null and b/docs/6-ecom-solution-enhancement/assets/promotions-vip-customers.png differ