{"id":7344,"date":"2020-05-28T07:50:14","date_gmt":"2020-05-28T07:50:14","guid":{"rendered":"https:\/\/expertwebtechnologies.com\/?p=7344"},"modified":"2025-01-07T13:20:42","modified_gmt":"2025-01-07T13:20:42","slug":"woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page","status":"publish","type":"post","link":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/","title":{"rendered":"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page."},"content":{"rendered":"\n<div>\n<h1>How to add the same product twice to cart instead of changing quantity in WooCommerce<\/h1>\n<p>In normal case when we increase quantity of product in WooCommerce cart it simply increase quantity of same product that&#8217;s one product with incremented quantity.<br>\nBut In some of cases, We like to have product in WooCommerce added in the cart as separate items and not as the same item with the changed quantity.<br>\nBasically we need to display separate cart items for product quantity &gt; 1.<br>\nWe can do that with pasting the code To the functions.php of theme.<\/p>\n<h4 style=\"font-weight: bold;\">This Is Done Basically In Two Steps:<\/h4>\n<p>&nbsp;<\/p>\n<h4 style=\"font-weight: bold;\">Step 1: Split product quantities into multiple cart items.<\/h4>\n<p>&nbsp;<\/p>\n<p>In This Hooks Basically, when we are adding a new product to cart ,we have added a unique key to each cart item meta. that&#8217;s why the same product become distinct product each time.<\/p>\n<p>For Adding unique meta key we will use &#8216;woocommerce_add_cart_item_data&#8217; filter.<\/p>\n<pre class=\" language-php\"><code class=\" language-php\">\n\t\t<span class=\"snip keyword\">function<\/span> <span class=\"snip function\">AddNewProductInsteadChangeQuantity<\/span>( $cart_item_data, $product_id ) {\n\t\t  $distinctive_cart_item_key = <span class=\"snip function\">md5<\/span>( <span class=\"snip function\">microtime<\/span>() . <span class=\"snip function\">rand<\/span>() );\n\t\t  $cart_item_data[<span class=\"snip string\">'distinctive_key'<\/span>] = $distinctive_cart_item_key;\n\t\t  <span class=\"snip keyword\">return<\/span> $cart_item_data;\n\t\t}\n\t\t<span class=\"snip function\">add_filter<\/span>(<span class=\"snip string\">'woocommerce_add_cart_item_data'<\/span>,<span class=\"snip string\">'AddNewProductInsteadChangeQuantity'<\/span>,<span class=\"snip number\">11<\/span>,<span class=\"snip number\">2<\/span>);\n\t<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h4 style=\"font-weight: bold;\">Step 2: Force add to cart quantity to 1 and disable +- quantity input .Product can still be added multiple times to cart<\/h4>\n<p>&nbsp;<\/p>\n<pre class=\" language-php\"><code class=\" language-php\">\n<span class=\"snip function\">add_filter<\/span>(<span class=\"snip string\">'woocommerce_is_sold_individually'<\/span>,<span class=\"snip string\">'__return_true'<\/span> );\n\t<\/code><\/pre>\n<figure><img decoding=\"async\" src=\"https:\/\/expertwebtechnologies.com\/blogs\/wp-content\/uploads\/2020\/05\/Capture-10.png\" alt=\"null\"><\/figure><p><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to add the same product twice to cart instead of changing quantity in WooCommerce In normal case when we increase quantity of product in WooCommerce cart it simply increase quantity of same product that&#8217;s one product with incremented quantity. But In some of cases, We like to have product in WooCommerce added in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8674,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,35,36],"tags":[],"class_list":["post-7344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce","category-woocommerce-hooks","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page. - EoXys IT<\/title>\n<meta name=\"description\" content=\"Discover how to modify WooCommerce to add the same product to the cart twice instead of adjusting the quantity. Follow simple steps to customize your cart functionality for better user experience.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page. - EoXys IT\" \/>\n<meta property=\"og:description\" content=\"Discover how to modify WooCommerce to add the same product to the cart twice instead of adjusting the quantity. Follow simple steps to customize your cart functionality for better user experience.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\" \/>\n<meta property=\"og:site_name\" content=\"EoXys IT\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-28T07:50:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-07T13:20:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\" \/>\n\t<meta property=\"og:image:width\" content=\"768\" \/>\n\t<meta property=\"og:image:height\" content=\"430\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Shiv kumawat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shiv kumawat\" \/>\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:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\"},\"author\":{\"name\":\"Shiv kumawat\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/b8b420c1462d95348959794eec60fb59\"},\"headline\":\"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page.\",\"datePublished\":\"2020-05-28T07:50:14+00:00\",\"dateModified\":\"2025-01-07T13:20:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\"},\"wordCount\":199,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"articleSection\":[\"Woocommerce\",\"Woocommerce Hooks\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\",\"url\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\",\"name\":\"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page. - EoXys IT\",\"isPartOf\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"datePublished\":\"2020-05-28T07:50:14+00:00\",\"dateModified\":\"2025-01-07T13:20:42+00:00\",\"author\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/b8b420c1462d95348959794eec60fb59\"},\"description\":\"Discover how to modify WooCommerce to add the same product to the cart twice instead of adjusting the quantity. Follow simple steps to customize your cart functionality for better user experience.\",\"breadcrumb\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage\",\"url\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"contentUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png\",\"width\":768,\"height\":430,\"caption\":\"Code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eoxysit.com\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#website\",\"url\":\"https:\/\/eoxysit.com\/blogs\/\",\"name\":\"EoXys IT\",\"description\":\"Digitise your business\",\"alternateName\":\"Eoxys It\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eoxysit.com\/blogs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/b8b420c1462d95348959794eec60fb59\",\"name\":\"Shiv kumawat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png\",\"contentUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png\",\"caption\":\"Shiv kumawat\"},\"description\":\"\\\"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company\\\"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.\u201d\",\"sameAs\":[\"https:\/\/eoxysit.com\/\"],\"url\":\"https:\/\/eoxysit.com\/blogs\/author\/shivkumawat1985\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page. - EoXys IT","description":"Discover how to modify WooCommerce to add the same product to the cart twice instead of adjusting the quantity. Follow simple steps to customize your cart functionality for better user experience.","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:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/","og_locale":"en_US","og_type":"article","og_title":"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page. - EoXys IT","og_description":"Discover how to modify WooCommerce to add the same product to the cart twice instead of adjusting the quantity. Follow simple steps to customize your cart functionality for better user experience.","og_url":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/","og_site_name":"EoXys IT","article_published_time":"2020-05-28T07:50:14+00:00","article_modified_time":"2025-01-07T13:20:42+00:00","og_image":[{"width":768,"height":430,"url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","type":"image\/png"}],"author":"Shiv kumawat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Shiv kumawat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#article","isPartOf":{"@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/"},"author":{"name":"Shiv kumawat","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/b8b420c1462d95348959794eec60fb59"},"headline":"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page.","datePublished":"2020-05-28T07:50:14+00:00","dateModified":"2025-01-07T13:20:42+00:00","mainEntityOfPage":{"@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/"},"wordCount":199,"commentCount":0,"image":{"@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage"},"thumbnailUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","articleSection":["Woocommerce","Woocommerce Hooks","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/","url":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/","name":"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page. - EoXys IT","isPartOf":{"@id":"https:\/\/eoxysit.com\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage"},"image":{"@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage"},"thumbnailUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","datePublished":"2020-05-28T07:50:14+00:00","dateModified":"2025-01-07T13:20:42+00:00","author":{"@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/b8b420c1462d95348959794eec60fb59"},"description":"Discover how to modify WooCommerce to add the same product to the cart twice instead of adjusting the quantity. Follow simple steps to customize your cart functionality for better user experience.","breadcrumb":{"@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#primaryimage","url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","contentUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/woocommerce-products-custom-fields.png","width":768,"height":430,"caption":"Code"},{"@type":"BreadcrumbList","@id":"https:\/\/eoxysit.com\/blogs\/woocommerce-add-same-product-to-cart-twice-instead-of-changing-quantity-in-cart-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eoxysit.com\/blogs\/"},{"@type":"ListItem","position":2,"name":"WooCommerce : Add same product to cart twice instead of changing quantity in Cart Page."}]},{"@type":"WebSite","@id":"https:\/\/eoxysit.com\/blogs\/#website","url":"https:\/\/eoxysit.com\/blogs\/","name":"EoXys IT","description":"Digitise your business","alternateName":"Eoxys It","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eoxysit.com\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/b8b420c1462d95348959794eec60fb59","name":"Shiv kumawat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png","contentUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png","caption":"Shiv kumawat"},"description":"\"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company\"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.\u201d","sameAs":["https:\/\/eoxysit.com\/"],"url":"https:\/\/eoxysit.com\/blogs\/author\/shivkumawat1985\/"}]}},"_links":{"self":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts\/7344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/comments?post=7344"}],"version-history":[{"count":0,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts\/7344\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/media\/8674"}],"wp:attachment":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/media?parent=7344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/categories?post=7344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/tags?post=7344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}