typescript-cart
Typescript-cart is a small JavaScript/Typescript cart for e-commerce. It has functionality for currencies, VAT and weight.
Installation
With npm
npm install --save typescript-cart
Documentation
Documentation is available here.
Example
An example of the cart.
; ; // Add single itemcart.addItem; // Add multiple itemscart.addItem; // Get all products; // Add another of product nr 1products.setQuantity1, true; // Remove productproducts.remove; // Set currency to display prices (standard is EUR)cart.setCurrencyCurrencies.GBP; // Print priceconsole.logcart.getTotalPrice; // Set weight unitscart.setWeightUnitSystemWeightUnits.GRAM; // Print weightconsole.logcart.getWeight;
Contribute
Make sure to run the tests
npm test