@hadimalikdev/shopifycart

0.1.1 • Public • Published

Table of Contents

ShopifyCart

Represents a simple Shopify cart

Uses the fetch API

Parameters

  • root_url String Locale aware root URL. Most commonly accessed using window.Shopify.routes.root (optional, default '/')
  • logging Object Set up logging (optional, default {})

addItem

Adds an item to the cart

Parameters

  • variant_id Number
  • quantity Number? Quantity of variant to be added. (optional, default 1)
  • line_item_properties Object<string, string>? Key-value pairs of line item properties
  • selling_plan Number? ID of selling plan

Returns Promise Returns API response

modifyCartItemByKey

Modifies quantity of a line item using line_item_key

Parameters

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 cart
  • quantity Number Updated quantity
  • line_item_properties Object<string, string>? Key-value pairs of line item properties
  • selling_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 cart
  • quantity Number New quantity of item
  • line_item_properties Object<string, string> Properties of the cart item
  • selling_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 is
  • attributes 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

Readme

Keywords

Package Sidebar

Install

npm i @hadimalikdev/shopifycart

Weekly Downloads

2

Version

0.1.1

License

ISC

Unpacked Size

16.3 kB

Total Files

3

Last publish

Collaborators

  • hadimalikdev