MageSmith
MutationQuote · Magento 2.4.9

assignCustomerToGuestCart

assignCustomerToGuestCart is a Magento 2 GraphQL mutation in the Quote module. phpcs:ignore Magento2.GraphQL.ValidArgumentName. It returns Cart! and requires an Authorization header (Bearer customer token).

Last verified: against Magento 2.4.9.

Returns

Cart!

Resolver class

Magento\QuoteGraphQl\Model\Resolver\AssignCustomerToGuestCart

Arguments

cart_id String! Required

Example request

Auto-generated from the SDL — paste-ready against your store's /graphql endpoint. Replace the host, store code, and any required values before running.

Headers

Content-Type
application/json
Store
default store view code; use 'default' for the single-store baseline
Authorization
Bearer <CUSTOMER_TOKEN> obtain from generateCustomerToken mutation

Query

mutation ($cart_id: String!) {
  assignCustomerToGuestCart(cart_id: $cart_id) {
    gift_message {
      to
      from
      message
    }
    id
    items {
      not_available_message
      id
      uid
      quantity
      is_available
      prices {
        price { ... }
        price_including_tax { ... }
        row_total { ... }
        row_total_including_tax { ... }
        discounts { ... }
        total_item_discount { ... }
        original_item_price { ... }
        original_row_total { ... }
        catalog_discount { ... }
        row_catalog_discount { ... }
        fixed_product_taxes { ... }
      }
      product {
        id
        uid
        name
        sku
        description { ... }
        short_description { ... }
        special_price
        special_from_date
        special_to_date
        attribute_set_id
        meta_title
        meta_keyword
        meta_description
        image { ... }
        small_image { ... }
        thumbnail { ... }
        new_from_date
        new_to_date
        tier_price
        options_container
        created_at
        updated_at
        country_of_manufacture
        type_id
        websites { ... }
        product_links { ... }
        media_gallery_entries { ... }
        price { ... }
        price_range { ... }
        gift_message_available
        manufacturer
        categories { ... }
        canonical_url
        media_gallery { ... }
        custom_attributesV2 { ... }
        tier_prices { ... }
        price_tiers { ... }
        only_x_left_in_stock
        stock_status
        quantity
        min_sale_qty
        max_sale_qty
        url_key
        url_suffix
        url_path
        url_rewrites { ... }
        related_products { ... }
        upsell_products { ... }
        crosssell_products { ... }
        rating_summary
        review_count
        reviews { ... }
        swatch_image
      }
      errors {
        code
        message
      }
    }
    itemsV2 {
      items {
        not_available_message
        id
        uid
        quantity
        is_available
        prices { ... }
        product { ... }
        errors { ... }
      }
      page_info {
        page_size
        current_page
        total_pages
      }
      total_count
    }
    applied_coupon {
      code
    }
    applied_coupons {
      code
    }
    email
    shipping_addresses {
      available_shipping_methods {
        carrier_code
        carrier_title
        method_code
        method_title
        error_message
        amount { ... }
        base_amount { ... }
        price_excl_tax { ... }
        price_incl_tax { ... }
        available
      }
      selected_shipping_method {
        carrier_code
        method_code
        carrier_title
        method_title
        amount { ... }
        base_amount { ... }
        price_excl_tax { ... }
        price_incl_tax { ... }
      }
      customer_notes
      items_weight
      cart_items {
        cart_item_id
        quantity
      }
      cart_items_v2 {
        not_available_message
        id
        uid
        quantity
        is_available
        prices { ... }
        product { ... }
        errors { ... }
      }
      same_as_billing
      pickup_location_code
    }
    billing_address {
      customer_notes
    }
    available_payment_methods {
      is_deferred
      code
      title
    }
    selected_payment_method {
      code
      title
      purchase_order_number
    }
    prices {
      grand_total {
        value
        currency
      }
      grand_total_excluding_tax {
        value
        currency
      }
      subtotal_including_tax {
        value
        currency
      }
      subtotal_excluding_tax {
        value
        currency
      }
      discount {
        amount { ... }
        label
      }
      subtotal_with_discount_excluding_tax {
        value
        currency
      }
      applied_taxes {
        amount { ... }
        label
      }
      discounts {
        amount { ... }
        applied_to
        label
        coupon { ... }
      }
    }
    total_quantity
    is_virtual
    rules {
      uid
    }
  }
}

Variables

{
  "cart_id": ""
}

Every Magento dev tool, in one hosted workspace.

Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.