calculations-swedish-webshop
v2.0.0
Published
calculations in cart and checkout for swedish webshop
Downloads
13
Readme
Install
npm i calculations-swedish-webshop
Usage
ES6 import:
import calc from 'calculations-swedish-webshop'
Methods:
calcNumberOfProducts: calculates the number of the items in cart. It take an array as parameter and every element in the array should have "quantity" property
calcTotalWithoutShipping: calculates the total price (without shipping) of the items in cart. It take an array as parameter and every element in the array should have "quantity" and "price" properties
calcShipping : calculate shipping : total > 500 => shipping: 0. total <= 500 => shipping: 59
calcTotalWithShipping : calculate the sum of calcTotalWithoutShipping + calcShipping
calcTotalWithoutShippingOrWrapping: Calculate total without shipping or giftwrapping because giftwrapping will not have 25% moms
calcMoms: take two parameters: en array with products + moms percentage to calculate (it uses calcTotalWithoutShippingOrWrapping)
calcTotalMoms: calculate total moms. takes an array of products as parameter, every element in the array should have "quantity", "price" and "moms" properties. "moms" is the moms percentage for the product
calcGiftWrapping: calculate gift wrapping price for the given array of products, every product should have "giftWrapping" and "quantity" properties. Gift wrapping is 25/st