{"id":413726,"date":"2024-02-08T06:39:29","date_gmt":"2024-02-08T06:39:29","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=413726"},"modified":"2024-03-21T05:22:50","modified_gmt":"2024-03-21T05:22:50","slug":"magento-2-add-configurableproducts-to-cart-using-graphql","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/","title":{"rendered":"Magento 2 add configurable, downloadable, bundle and virtual products to cart using GraphQL"},"content":{"rendered":"\n<p>In this article, We will learn about how to add configurable products to the cart using Graphql in Magento 2.<\/p>\n\n\n\n<p>In the previous blog, We learned about how to add simple products to cart using GraphQl <a href=\"https:\/\/webkul.com\/blog\/how-to-add-products-in-cart-using-graphql\/\">How to add simple products to cart using GraphQl<\/a><\/p>\n\n\n\n<p>Follow the below step to add configurable products to the cart using Graphql in Magento 2.<\/p>\n\n\n\n<p><strong>GraphQL Endpoint:<\/strong>&nbsp;BASE_URL\/graphql<br>Example: http:\/\/example.com\/graphql<\/p>\n\n\n\n<p>First off, we need to create an empty cart to add products in Magento 2.<\/p>\n\n\n\n<p>We have created an empty cart for the guest user using the following mutation, token is not required for the guest user.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"864\" height=\"539\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png\" alt=\"add configurable products to the cart using graphql in magento 2\" class=\"wp-image-420569\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png 864w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2-300x187.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2-250x156.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2-768x479.png 768w\" sizes=\"(max-width: 864px) 100vw, 864px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Add a configurable product.<\/h2>\n\n\n\n<p>Use the&nbsp;<code>addConfigurableProductsToCart<\/code>&nbsp;mutation to add configurable products to the shopping cart.<\/p>\n\n\n\n<p>In the following example add one product with configuration options color is red.<\/p>\n\n\n\n<p><strong>Request:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">mutation {\n  addConfigurableProductsToCart(\n    input: {\n      cart_id: &quot;SPBJroclB7zT45lgY0stDJmpPnvcsGx2&quot;\n      cart_items: &#091;{\n        parent_sku: &quot;configurable&quot;\n        data: {\n          quantity: 1,\n          sku: &quot;configurable-red&quot;\n        }\n      }]\n    }\n  ) {\n    cart {\n      items {\n        id\n        product {\n          name\n          sku\n          options_container\n        }\n        quantity\n        ... on ConfigurableCartItem{\n        \tconfigurable_options{\n            id\n            option_label\n            value_label\n            value_id\n          }\n        }\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<p><strong>Response:<\/strong><\/p>\n\n\n\n<p>Execute the mutation through your GraphQL client, and the configurable product will be added to the cart.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n    &quot;data&quot;: {\n        &quot;addConfigurableProductsToCart&quot;: {\n            &quot;cart&quot;: {\n                &quot;items&quot;: &#091;\n                    {\n                        &quot;id&quot;: &quot;732&quot;,\n                        &quot;product&quot;: {\n                            &quot;name&quot;: &quot;configurable&quot;,\n                            &quot;sku&quot;: &quot;configurable&quot;,\n                            &quot;options_container&quot;: &quot;container2&quot;\n                        },\n                        &quot;quantity&quot;: 1,\n                        &quot;configurable_options&quot;: &#091;\n                            {\n                                &quot;id&quot;: 93,\n                                &quot;option_label&quot;: &quot;Color&quot;,\n                                &quot;value_label&quot;: &quot;red&quot;,\n                                &quot;value_id&quot;: 4\n                            }\n                        ]\n                    }\n                ]\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add a downloadable product to a cart<\/h2>\n\n\n\n<p>Use the&nbsp;<code>addDownloadableProductsToCart<\/code>&nbsp;mutation to add downloadable products to the shopping cart.<\/p>\n\n\n\n<p>A downloadable product can be anything that you can download as a file, such as an eBook, music or video.<\/p>\n\n\n\n<p><strong>Request:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">mutation {\n  addDownloadableProductsToCart(\n    input: {\n      cart_id: &quot;SPBJroclB7zT45lgY0stDJmpPnvcsGx2&quot;\n      cart_items: {\n        data: {\n          sku: &quot;downlodableProdc&quot;\n          quantity: 1\n        }\n        downloadable_product_links: &#091;\n          {\n            link_id: 2                \n          }\n          {\n            link_id: 5                 \n          }\n        ]\n      }\n    }\n  ) {\n    cart {\n      items {\n        product {\n          id\n          sku\n          name\n        }\n        quantity\n        ... on DownloadableCartItem {\n          links {\n            title\n            price\n          }\n          samples {\n            title\n            sample_url\n          }\n        }\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<p><strong>Response:<\/strong><\/p>\n\n\n\n<p>Execute the mutation through your GraphQL client, and the downloadable product will be added to the cart.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n    &quot;data&quot;: {\n        &quot;addDownloadableProductsToCart&quot;: {\n            &quot;cart&quot;: {\n                &quot;items&quot;: &#091;\n                    {\n                        &quot;product&quot;: {\n                            &quot;id&quot;: 76,\n                            &quot;sku&quot;: &quot;downlodableProdc&quot;,\n                            &quot;name&quot;: &quot;downlodableProdc&quot;\n                        },\n                        &quot;quantity&quot;: 1,\n                        &quot;links&quot;: &#091;\n                            {\n                                &quot;title&quot;: &quot;sampleAudio&quot;,\n                                &quot;price&quot;: 21\n                            },\n                            {\n                                &quot;title&quot;: &quot;Sample 2&quot;,\n                                &quot;price&quot;: 32\n                            }\n                        ],\n                        &quot;samples&quot;: &#091;\n                            {\n                                &quot;title&quot;: &quot;tre&quot;,\n                                &quot;sample_url&quot;: &quot;https:\/\/example.com\/downloadable\/download\/sample\/sample_id\/1\/&quot;\n                            }\n                        ]\n                    }\n                ]\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add a bundle product to a cart<\/h2>\n\n\n\n<p>Use the&nbsp;<code>addBundleProductsToCart<\/code>&nbsp;mutation to add bundle products to the shopping cart.<\/p>\n\n\n\n<p>This example adds one bundle product to the shopping cart. The SKU of this product &nbsp;<strong>bundleProduct<\/strong><\/p>\n\n\n\n<p><strong>Request:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">mutation {\n  addBundleProductsToCart(\n    input: {\n      cart_id: &quot;SPBJroclB7zT45lgY0stDJmpPnvcsGx2&quot;\n      cart_items: &#091;\n      {\n        data: {\n          sku: &quot;bundleProduct&quot;\n          quantity: 1\n        }\n        bundle_options: &#091;\n          {\n            id: 2\n            quantity: 1\n            value: &#091;\n              &quot;4&quot;\n            ]\n          } \n        ]\n      },\n    ]\n  }) {\n    cart {\n      items {\n        id\n        quantity\n        product {\n          sku\n          name\n        }\n        ... on BundleCartItem {\n          bundle_options {\n            id\n            label\n            type\n            values {\n              id\n              label\n              price\n              quantity\n            }\n          }\n        }\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<p><strong>Response:<\/strong><\/p>\n\n\n\n<p>Execute the mutation through your GraphQL client, and the bundle product will be added to the cart.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n    &quot;data&quot;: {\n        &quot;addBundleProductsToCart&quot;: {\n            &quot;cart&quot;: {\n                &quot;items&quot;: &#091;\n                    {\n                        &quot;id&quot;: &quot;114&quot;,\n                        &quot;quantity&quot;: 1,\n                        &quot;product&quot;: {\n                            &quot;sku&quot;: &quot;bundleProduct&quot;,\n                            &quot;name&quot;: &quot;bundleProduct&quot;\n                        },\n                        &quot;bundle_options&quot;: &#091;\n                            {\n                                &quot;id&quot;: 2,\n                                &quot;label&quot;: &quot;Simple&quot;,\n                                &quot;type&quot;: &quot;select&quot;,\n                                &quot;values&quot;: &#091;\n                                    {\n                                        &quot;id&quot;: 4,\n                                        &quot;label&quot;: &quot;simple&quot;,\n                                        &quot;price&quot;: 10,\n                                        &quot;quantity&quot;: 1\n                                    }\n                                ]\n                            }\n                        ]\n                    }\n                ]\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add VirtualProduct to a cart<\/h2>\n\n\n\n<p>Use the&nbsp;<code>addVirtualProductsToCart<\/code>&nbsp;mutation to add virtual products to the shopping cart.<\/p>\n\n\n\n<p>A virtual product represents a saleable item that is not physical, such as a membership, service, warranty, or subscription. Virtual products do not need to be shipped or downloaded, nor do they require stock management.<\/p>\n\n\n\n<p><strong>Request:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">mutation {\n  addVirtualProductsToCart(\n    input: {\n      cart_id: &quot;pIRMnP9PtmZ7lu3b22mb7niTMnFhu0Nw&quot;,\n      cart_items: &#091;\n        {\n          data: {\n            quantity: 1\n            sku: &quot;virtualProduct&quot;\n          }\n        }\n       ]\n    }\n  ) {\n    cart {\n      items {\n        product {\n          name\n        }\n        quantity\n      }\n      prices {\n        grand_total {\n          value\n          currency\n        }\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<p><strong>Response:<\/strong><\/p>\n\n\n\n<p>Execute the mutation through your GraphQL client, and the virtual product will be added to the cart.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n    &quot;data&quot;: {\n        &quot;addVirtualProductsToCart&quot;: {\n            &quot;cart&quot;: {\n                &quot;items&quot;: &#091;\n                    {\n                        &quot;product&quot;: {\n                            &quot;name&quot;: &quot;virtualProduct&quot;\n                        },\n                        &quot;quantity&quot;: 1\n                    }\n                ],\n                &quot;prices&quot;: {\n                    &quot;grand_total&quot;: {\n                        &quot;value&quot;: 100,\n                        &quot;currency&quot;: &quot;USD&quot;\n                    }\n                }\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p>Hope this will help you.<\/p>\n\n\n\n<p>Thanks \ud83d\ude42<\/p>\n\n\n\n<p>You can check the following blogs related to GraphQl:<\/p>\n\n\n\n<p><a href=\"https:\/\/webkul.com\/blog\/product-types-of-magento-2\/\">Product Types in Magento 2<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/webkul.com\/blog\/how-to-add-products-in-cart-using-graphql\/\">How to add simple products to cart using GraphQL<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/webkul.com\/blog\/graphql-implementation-in-magento2\/\">GraphQl implementation in Magento 2<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\">GraphQL Mutation<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, We will learn about how to add configurable products to the cart using Graphql in Magento 2. In the previous blog, We learned about how to add simple products to cart using GraphQl How to add simple products to cart using GraphQl Follow the below step to add configurable products to the <a href=\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":379,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121],"tags":[292,1988,2677,672,7085,2460,15260,1003],"class_list":["post-413726","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-api","tag-bundle-product","tag-configurable-product","tag-downloadable-product","tag-graphql","tag-magento-2","tag-magento-2-add-product-to-cart-using-grapql","tag-virtual-product"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Add configurable products to the cart using graphql in magento 2<\/title>\n<meta name=\"description\" content=\"In this article, add configurable products to the cart using graphql in magento 2.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add configurable products to the cart using graphql in magento 2\" \/>\n<meta property=\"og:description\" content=\"In this article, add configurable products to the cart using graphql in magento 2.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-08T06:39:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-21T05:22:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png\" \/>\n<meta name=\"author\" content=\"Krishna Mohan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Krishna Mohan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\"},\"author\":{\"name\":\"Krishna Mohan\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/32da2f954b256b95b4c44ddeacca51b1\"},\"headline\":\"Magento 2 add configurable, downloadable, bundle and virtual products to cart using GraphQL\",\"datePublished\":\"2024-02-08T06:39:29+00:00\",\"dateModified\":\"2024-03-21T05:22:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\"},\"wordCount\":387,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png\",\"keywords\":[\"api\",\"bundle product\",\"Configurable Product\",\"downloadable product\",\"graphQL\",\"Magento 2\",\"magento 2 add product to cart using grapql\",\"virtual product\"],\"articleSection\":[\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\",\"url\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\",\"name\":\"Add configurable products to the cart using graphql in magento 2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png\",\"datePublished\":\"2024-02-08T06:39:29+00:00\",\"dateModified\":\"2024-03-21T05:22:50+00:00\",\"description\":\"In this article, add configurable products to the cart using graphql in magento 2.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png\",\"width\":864,\"height\":539,\"caption\":\"emptycart-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magento 2 add configurable, downloadable, bundle and virtual products to cart using GraphQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/32da2f954b256b95b4c44ddeacca51b1\",\"name\":\"Krishna Mohan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ff4d070d18606ffded6efe51b5703bf4b6a46b26b9e4db5e6ecfdbf023daab4c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ff4d070d18606ffded6efe51b5703bf4b6a46b26b9e4db5e6ecfdbf023daab4c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Krishna Mohan\"},\"description\":\"Krishna, a Software Engineer, specializes in the Magento platform, delivering high-performance eCommerce solutions. Expertise spans custom development, system optimization, and seamless integration, driving innovation and enhancing business operations.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/krishna-mohan439webkul-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add configurable products to the cart using graphql in magento 2","description":"In this article, add configurable products to the cart using graphql in magento 2.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/","og_locale":"en_US","og_type":"article","og_title":"Add configurable products to the cart using graphql in magento 2","og_description":"In this article, add configurable products to the cart using graphql in magento 2.","og_url":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2024-02-08T06:39:29+00:00","article_modified_time":"2024-03-21T05:22:50+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png","type":"","width":"","height":""}],"author":"Krishna Mohan","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Krishna Mohan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/"},"author":{"name":"Krishna Mohan","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/32da2f954b256b95b4c44ddeacca51b1"},"headline":"Magento 2 add configurable, downloadable, bundle and virtual products to cart using GraphQL","datePublished":"2024-02-08T06:39:29+00:00","dateModified":"2024-03-21T05:22:50+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/"},"wordCount":387,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png","keywords":["api","bundle product","Configurable Product","downloadable product","graphQL","Magento 2","magento 2 add product to cart using grapql","virtual product"],"articleSection":["Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/","url":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/","name":"Add configurable products to the cart using graphql in magento 2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png","datePublished":"2024-02-08T06:39:29+00:00","dateModified":"2024-03-21T05:22:50+00:00","description":"In this article, add configurable products to the cart using graphql in magento 2.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/02\/emptycart-2.png","width":864,"height":539,"caption":"emptycart-2"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/magento-2-add-configurableproducts-to-cart-using-graphql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Magento 2 add configurable, downloadable, bundle and virtual products to cart using GraphQL"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/32da2f954b256b95b4c44ddeacca51b1","name":"Krishna Mohan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ff4d070d18606ffded6efe51b5703bf4b6a46b26b9e4db5e6ecfdbf023daab4c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ff4d070d18606ffded6efe51b5703bf4b6a46b26b9e4db5e6ecfdbf023daab4c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Krishna Mohan"},"description":"Krishna, a Software Engineer, specializes in the Magento platform, delivering high-performance eCommerce solutions. Expertise spans custom development, system optimization, and seamless integration, driving innovation and enhancing business operations.","url":"https:\/\/webkul.com\/blog\/author\/krishna-mohan439webkul-com\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/413726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/379"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=413726"}],"version-history":[{"count":32,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/413726\/revisions"}],"predecessor-version":[{"id":421047,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/413726\/revisions\/421047"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=413726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=413726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=413726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}