// Initialize
shoppy.init({
token: 'your-storefront-token',
storeDomain: 'store.myshopify.com'
})
// Collections
const collections = await shoppy.collections.list()
const collection = await shoppy.collections.get('summer-sale')
// Products
const products = await shoppy.products.list()
const product = await shoppy.products.get('blue-shirt')
// Products by collection
const { items } = await shoppy.products.collection('sale').list()
// With options
const result = await shoppy.products
.collection('new')
.limit(6)
.select(['title', 'handle', 'priceRange'])
.list()
// Cart
await shoppy.cart.init()
await shoppy.cart.add('gid://shopify/ProductVariant/123', 2)
shoppy.cart.checkout()
// Customer Authentication
const customer = await shoppy.customer.login('[email protected]', 'password')
const { orders } = await shoppy.customer.orders()
await shoppy.customer.logout()