Storefront API - Customer Cart

Hmmaen
New Member
2 0 0

Hi,

We create cart with Storefront APIs cartCreate mutation and attach customer to cart with cartBuyerIdentityUpdate mutation. I know I can query cart with cart id, but can i query cart with customer access token or customer email address?

 

0 Likes
AlanForsVispero
Tourist
6 1 0

Hi Hmmaen,

Have you been able to create a cart with line items in it? When I do  so, the cart is always returned empty.

0 Likes
Hmmaen
New Member
2 0 0

Yes, with createCart-mutation like:

mutation createCart($cartInput: CartInput) {
  cartCreate(input: $cartInput) {
    cart {
      id
      createdAt
      updatedAt
      lines(first:10) {
        edges {
          node {
            id
            merchandise {
              ... on ProductVariant {
                id 
                sku
              }
            }
          }
        }
      }
    }
  }
}

 

cartInput where merchandiseId value is variants storefrontid:

{
  "cartInput": {
    "lines": [
      {
        "quantity": 6,
        "merchandiseId": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zOTgwNTMzMjY1MjIwOA=="
      }
    ]
  }
}

 

0 Likes
AlanForsVispero
Tourist
6 1 0

That looks remarkably similar to the mutation I'm using, yet I always end up with an empty cart.

Thanks for responding.

0 Likes