How To Add Bundle Products in Cart By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

How To Add Bundle Products By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Use the updateCartItems mutation to update shopping cart items and removeItemFromCart to remove a product from the shopping cart.

The following below steps need to follow to add Configurable products by using GraphQL in Magento 2.x

Here Using Postman

Step [1] – Recommendation to use below Bundle Products syntax

mutation {
addBundleProductsToCart(
input: AddBundleProductsToCartInput
) {
AddBundleProductsToCartOutput
}
}

Step [2] – Put below Request

mutation {
  addBundleProductsToCart(
    input: {
      cart_id: "s6Wgi4j0H2ULX0YHfD3mhOMHuAL10qLL"
      cart_items: [
      {
        data: {
          sku: "24-WG080"
          quantity: 1
        }
        bundle_options: [
          {
            id: 1
            quantity: 1
            value: [
              "2"
            ]
          },
          {
            id: 2
            quantity: 2
            value: [
              "4"
            ]
          },
          {
            id: 3
            quantity: 1
            value: [
              "7"
            ]
          },
          {
            id: 4
            quantity: 1
            value: [
              "8"
            ]
          }
        ]
      },
    ]
  }) {
    cart {
      items {
        id
        quantity
        product {
          sku
          name
        }
        ... on BundleCartItem {
          bundle_options {
            id
            label
            type
            values {
              id
              label
              price
              quantity
            }
          }
        }
      }
    }
  }
}

Step [3] – Below output response

{
    "data": {
        "addBundleProductsToCart": {
            "cart": {
                "items": [
                    {
                        "id": "131",
                        "quantity": 2,
                        "product": {
                            "sku": "Gaming-Software",
                            "name": "Gaming-Software"
                        }
                    },
                    {
                        "id": "132",
                        "quantity": 4,
                        "product": {
                            "sku": "24-WG080",
                            "name": "Sprite Yoga Companion Kit"
                        },
                        "bundle_options": [
                            {
                                "id": 1,
                                "label": "Sprite Stasis Ball",
                                "type": "radio",
                                "values": [
                                    {
                                        "id": 2,
                                        "label": "Sprite Stasis Ball 65 cm",
                                        "price": 27,
                                        "quantity": 1
                                    }
                                ]
                            },
                            {
                                "id": 2,
                                "label": "Sprite Foam Yoga Brick",
                                "type": "radio",
                                "values": [
                                    {
                                        "id": 4,
                                        "label": "Sprite Foam Yoga Brick",
                                        "price": 5,
                                        "quantity": 2
                                    }
                                ]
                            },
                            {
                                "id": 3,
                                "label": "Sprite Yoga Strap",
                                "type": "radio",
                                "values": [
                                    {
                                        "id": 7,
                                        "label": "Sprite Yoga Strap 10 foot",
                                        "price": 21,
                                        "quantity": 1
                                    }
                                ]
                            },
                            {
                                "id": 4,
                                "label": "Sprite Foam Roller",
                                "type": "radio",
                                "values": [
                                    {
                                        "id": 8,
                                        "label": "Sprite Foam Roller",
                                        "price": 19,
                                        "quantity": 1
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        }
    }
}

How To Add Downloadable Products By Using GraphQL in Cart in Magento 2.x / Adobe Commerce 2.x

How To Add Downloadable Products By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Use the updateCartItems mutation to update shopping cart items and removeItemFromCart to remove a product from the shopping cart.

The following below steps need to follow to add Downloadable products by using GraphQL in Magento 2.x

Step [1] – Recommendation to use below Downloadable Product syntax

Here Using Postman

Syntax –

mutation {
	 addDownloadableProductsToCart(
	 input: AddDownloadableProductsToCartInput
	 ) {
	 AddDownloadableProductsToCartOutput
	 }
	}

Step [2] – Put below Request

mutation {
  addDownloadableProductsToCart(
    input: {
      cart_id: "s6Wgi4j0H2ULX0YHfD3mhOMHuAL10qLL"
      cart_items: {
        data: {
          sku: "Gaming-Software"
          quantity: 1
        }
        downloadable_product_links: [
          {
            link_id: 7                 # Episode 2
          }
          {
            link_id: 8                 # Episode 3
          }
        ]
      }
    }
  ) {
    cart {
      items {
        product {
          id
          sku
          name
        }
        quantity
        ... on DownloadableCartItem {
          links {
            title
            price
          }
          samples {
            title
            sample_url
          }
        }
      }
    }
  }
}

Step [3] – Below output response

{
    "data": {
        "addDownloadableProductsToCart": {
            "cart": {
                "items": [
                    {
                        "product": {
                            "id": 2041,
                            "sku": "Gaming-Software",
                            "name": "Gaming-Software"
                        },
                        "quantity": 1,
                        "links": [
                            {
                                "title": "Gaming Software",
                                "price": 0
                            }
                        ],
                        "samples": []
                    }
                ]
            }
        }
    }
}

How To Create Customer Registration By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to create Customer Registration Details By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Step [1] – Recommendation to use below customer customer syntax

Here Using Postman

Syntax –

need to use createCustomer mutation to register the new customer account in the store.

Step [2] – Put below Request

mutation {
  createCustomer(
    input: {
      firstname: "John"
      lastname: "Doe"
      email: "johndusa1021@gmail.com"
      password: "admin123!!"
      is_subscribed: true
    }
  ) {
    customer {
      firstname
      lastname
      email
      is_subscribed
    }
  }
}
Continue reading “How To Create Customer Registration By Using GraphQL in Magento 2.x / Adobe Commerce 2.x”

How To Get Customer’s Wish List Items By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to get Customer’s Wishlist Items By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Step [1] – Recommendation to use below Customer’s Wishlist Items syntax

Here Using Postman

Syntax –

wishlist: WishlistOutput

Step [2] – Put below Request

{
  wishlist {
    items_count
    name
    sharing_code
    updated_at
    items {
      id
      qty
      description
      added_at
      product {
        sku
        name
      }
    }
  }
}
Continue reading “How To Get Customer’s Wish List Items By Using GraphQL in Magento 2.x / Adobe Commerce 2.x”

How To Check Customers Online in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to Check Customers Online in Magento 2.x / Adobe Commerce 2.x

Step [1] – Go To Left Panel Customers > Customers > Now Online

Step [2] – Once Clicked on Customers redirects on Customers Now Online Page

Step [3] – Finally, you can check Total Number of Customers Online

How To Get Currency By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to get store Currency By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Step [1] – Recommendation to use below Currency syntax

Here Using Postman

Syntax –

{currency {Currency}

Step [2] – Put below Request

query {
    currency {
        base_currency_code
        base_currency_symbol
        default_display_currency_code
        default_display_currency_symbol
        available_currency_codes
        exchange_rates {
            currency_to
            rate
        }
    }
}
Continue reading “How To Get Currency By Using GraphQL in Magento 2.x / Adobe Commerce 2.x”

Why Need To Configure Indexer From Update By Schedule Instead of Update On Save in Magento 2.x / Adobe Commerce 2.x

Once Magento 2.x / Adobe Commerce Site / Store running, suddenly require to change any Product’s Price, Product’s Inventory, Product’s Attributes, Product’s Images etc. these changes immediate effected on store front once Index Management / Indexer set to be Update By Schedule

Go To Admin

Step [1] – Click on Left Side Menu System

Step [2] – System -> Tools -> Index Management

Continue reading “Why Need To Configure Indexer From Update By Schedule Instead of Update On Save in Magento 2.x / Adobe Commerce 2.x”

How To Get Logged-in Customer Details By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to get logged-in Customer Details By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Step [1] – Recommendation to use below customer customer syntax

Here Using Postman

Syntax –

{customer: {Customer}}
Continue reading “How To Get Logged-in Customer Details By Using GraphQL in Magento 2.x / Adobe Commerce 2.x”

How To Get Customer Token or generateCustomerToken mutation By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to get Customer Token or generateCustomerToken mutation By using GraphQL in Magento 2.x / Adobe Commerce 2.x

Here Using PostMan

Step [1] – Recommendation to use below customer tokens in the header of your GraphQL call

Syntax –

mutation {
  generateCustomerToken(
    email: "Enter Customer Email"
    password: "Enter Customer Password"
  ) {
    token
  }
}
Continue reading “How To Get Customer Token or generateCustomerToken mutation By Using GraphQL in Magento 2.x / Adobe Commerce 2.x”