@hadimalikdev/shopifycart v0.1.1
Table of Contents
ShopifyCart
Represents a simple Shopify cart
Uses the fetch
API
Parameters
root_url
String Locale aware root URL. Most commonly accessed usingwindow.Shopify.routes.root
(optional, default'/'
)logging
Object Set up logging (optional, default{}
)
addItem
Adds an item to the cart
Parameters
variant_id
Numberquantity
Number? Quantity of variant to be added. (optional, default1
)line_item_properties
Object<string, string>? Key-value pairs of line item propertiesselling_plan
Number? ID of selling plan
Returns Promise Returns API response
modifyCartItemByKey
Modifies quantity of a line item using line_item_key
Parameters
line_item_key
Stringquantity
Number New quantityline_item_properties
Object<string, string>? Key-value pairs of line item propertiesselling_plan
Number? ID of selling plan
Returns Promise Returns API response
modifyCartItemByIndex
Modifies quantity of a line item based on 1-based index position of the item in the cart
Parameters
index
Number 1-based index of item in cartquantity
Number Updated quantityline_item_properties
Object<string, string>? Key-value pairs of line item propertiesselling_plan
Number? ID of selling plan
Returns Promise Returns API response
modifyCartItemByID
Modifies quantity of a line item based on variant id
Parameters
variant_id
String Variant ID of item in cartquantity
Number New quantity of itemline_item_properties
Object<string, string> Properties of the cart itemselling_plan
Number
Returns Promise Returns API response
getCart
Fetches cart
Returns Promise Returns API response
updateCart
Updates the cart note and attributes
Parameters
note
String Cart note. Pass undefined if want to leave as isattributes
Object<string, string> Cart attributes. Pass undefined if want to leave as is
Returns Promise Returns API response
clearCart
Removes all items from cart.
Returns Promise Returns API response
generateShippingRates
Generates shipping rates Use the getShippingRates function to retrieve rates once calculations are complete
Parameters
Returns Promise Returns API response
getShippingRates
Gets shipping rates Use the generateShippingRates function to calculate the rates
Parameters
Returns Promise Returns API response