8000 GitHub - makozi/plates-co: Plates Co's proof of concept for their new sales system
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ plates-co Public

Plates Co's proof of concept for their new sales system

Notifications You must be signed in to change notification settings

makozi/plates-co

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plates Co

Below is how the code works and any assumptions made:

The Basket component is a functional component that takes three props: catalog, deliveryRules, and offers. These props represent the product catalog, delivery charge rules, and special offers, respectively.

State Management:

It uses the useState hook to manage the state of the items in the basket (items).

addItem Function:

The addItem function is responsible for adding a product to the basket. It takes a productCode as a parameter. It uses the catalog prop to find the product information corresponding to the given productCode. If a product with the provided code is found, it updates the items state to include the new product.

calculateTotal Function:

The calculateTotal function computes the total cost of the items in the basket, taking into consideration delivery charges and special offers. It uses the items state to calculate the subtotal by summing up the prices of all items. It then iterates over the deliveryRules prop to determine the appropriate delivery charge based on the subtotal.

About

Plates Co's proof of concept for their new sales system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0