Cart module for Storinka skins.
yarn add @storinka/cart
import Cart from "@storinka/cart";
const coffeeItem = {
item_type: "dish",
item_id: 777,
quantity: 1,
subitems: [],
};
// create cart instance
const cart = new Cart();
// add item
cart.addItem(coffeeItem);
// remove item
cart.addItem(coffeeItem);
// find item
cart.findItem({ ...coffeeItem });
- Type:
string
- Values:
takeout | delivery
Type of the order.
- Type:
string
- Values:
fondy | terminal | cash
Payment method.
- Type:
OrderCustomerInputV3
Customer information.
- Type:
OrderDeliveryAddressInputV3 | undefined
Delivery address information when order type is delivery.
- Type:
number | undefined
Expected taking time when order type is takeout.
- Type:
string | undefined
Customer note.
- Type:
OrderItemInputV3[]
Order items.
- Result:
void
Add an item to the cart. If such item already exists (type, id and subitems do match), then quantity will be increased instead of adding new item.
- Result:
void
Remove an item from the cart.
- Result:
OrderItemInputV3 | undefined
Find an item in the cart. You can use it to check whether an item was already added to the cart or not.
- Result:
boolean
Check if two items are equal.
- Result:
boolean
Check if two subitems are equal.
- Result:
OrderInputV3
Create order input from the cart.