@arvellon97/nn-storefront-ts
v1.0.3
Published
## Usage
Downloads
7
Readme
New Narrative Storefront Module
Usage
Setup Cart (optionsal)
First of all, you need to initialize the Cart object. This can be done easily by usint the Cart.initialize()
method in a client side environment before using any cart functionality:
import Cart from "@arvellon97/nn-storefront-ts/classes/Cart";
useEffect(() => {
Cart.initialize();
}, []);
If you are not planning to use any cart functionality, you can skip this step. It can always be added later.
Fetching products
To fetch products or collections, the following methods are available:
getAllProducts()
getProductById(<shopify_product_id>)
getAllCollections()
getCollection(<shopify_collection_id>)
removeFromCart(<shopify_cart_line_id>)