You can view the actual discount logic below or view the live ui in front here https://checkout-demo.pages.dev/apac
Logic: src/App/Checkout/useCheckout/calculateTotal.ts
Unit test: src/App/Checkout/useCheckout/calculateTotal.test.ts
Products and pricing rules (dummy data): src/App/dummyData.ts
I have built a ui for fun and to finally try out Braid - it's super clean :)
Discount Types
- Fixed - set ad to a specified price
- Percentage - remove a percentage off the base ad price
- Buy X get X free (technically x for x) - add x (5) ads to cart and remove the price of x (1)
This project is powered by sku, braid and built with React.
First of all, make sure you've installed Yarn.
Then, install dependencies:
$ yarn
Start a local development server:
$ yarn start
Run unit tests:
$ yarn test
Lint and format code:
$ yarn lint
$ yarn format
Build assets for production:
$ yarn build