younifyd
Menu

cart_createCart

Creates a cart and generates a cart ID.

Use it in a workflow

  1. Add a step and choose the BigCommerce Storefront connector.
  2. Pick the cart_createCart action (under Create).
  3. Fill in the fields below, then reference the result from later steps as {{cartCreatecart.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation CartCreateCart($input: CreateCartInput!) {
  cart {
    createCart(input: $input) {
      cart {
        id
        entityId
        currencyCode
        displayCurrencyCode
        isTaxIncluded
        baseAmount {
          currencyCode
          value
          formatted
          formattedV2
        }
        baseAmountInDisplayCurrency {
          currencyCode
          value
          formatted
          formattedV2
        }
        discountedAmount {
          currencyCode
          value
          formatted
          formattedV2
        }
        discountedAmountInDisplayCurrency {
          currencyCode
          value
          formatted
          formattedV2
        }
        amount {
          currencyCode
          value
          formatted
          formattedV2
        }
        amountInDisplayCurrency {
          currencyCode
          value
          formatted
          formattedV2
        }
        discounts {
          entityId
          displayName
        }
        lineItems {
          totalQuantity
        }
        createdAt {
          utc
        }
        updatedAt {
          utc
        }
        locale
        version
        externalSource
        source
        companyId
      }
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

inputobjectrequired

Create cart input object

lineItemsarray<object>5 fields
giftCertificatesarray<object>7 fields
currencyCodestring
localestring
externalSourcestring
json
{
  "input": {
    "lineItems": [
      {
        "quantity": "string",
        "productEntityId": "string",
        "variantEntityId": "string",
        "sku": "string",
        "selectedOptions": "string"
      }
    ],
    "giftCertificates": [
      {
        "name": "string",
        "theme": "string",
        "amount": "string",
        "quantity": "string",
        "sender": "string",
        "recipient": "string",
        "message": "string"
      }
    ],
    "currencyCode": "string",
    "locale": "string",
    "externalSource": "string"
  }
}

Response

Read the result with {{cartCreatecart.response.data.data.createCart}}. If the API returns errors, the step fails and they are at {{cartCreatecart.response.data.errors}}.

cartobject
idstring
entityIdstring
currencyCodestring
displayCurrencyCodestring
isTaxIncludedboolean
baseAmountobject4 fields
baseAmountInDisplayCurrencyobject4 fields
discountedAmountobject4 fields
discountedAmountInDisplayCurrencyobject4 fields
amountobject4 fields
amountInDisplayCurrencyobject4 fields
discountsarray<object>
lineItemsobject5 fields
createdAtobject1 fields
updatedAtobject1 fields
localestring
versionnumber
externalSourcestring
sourcestring

One ofB2BB2B_INVOICEB2B_QUOTEBUY_NOW

companyIdnumber

Need more? See the BigCommerce Storefront guide for connection setup and behaviour shared by every action.