How to add group product into the cart individually?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I have two simple products associated with a group product at the product description page and have a separate add to cart button with each product I want to add these products to the cart individually But I am unable to When I press the first product to add to cart button both products are added to the cart. You can check the scenario by the following this link



this is my **group.phtml** file

<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* Grouped product data template
*
* @var $block MagentoCatalogBlockProductViewBaseImage
* @var $block MagentoGroupedProductBlockProductViewTypeGrouped
*/
?>
<?php $block->setPreconfiguredValue(); ?>
<?php $_product = $block->getProduct(); ?>
<?php $_associatedProducts = $block->getAssociatedProducts(); ?>
<?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
<?php $grouped = $_product->load($_product->getId()); ?>
<?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

<div class="table-wrapper grouped">
<table class="table data grouped" id="super-product-table">
<caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
<thead>
<tr>
<th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
<?php if ($_product->isSaleable()): ?>
<th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
<?php endif; ?>
</tr>
</thead>

<?php if ($_hasAssociatedProducts): ?>
<?php foreach ($associatedProducts as $_item): ?>
<tbody>
<tr>
<td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
<strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
<?php if ($block->getCanShowProductPrice($_product)): ?>
<?php if ($block->getCanShowProductPrice($_item)): ?>
<?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
<?php endif; ?>
<?php endif; ?>
</td>
<?php if ($_product->isSaleable()): ?>
<td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
<?php if ($_item->isSaleable()) : ?>
<div class="control qty">
<form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
<?php echo $block->getBlockHtml('formkey')?>
<input type="number"
name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
title="<?= /* @escapeNotVerified */ __('Qty') ?>"
class="input-text qty"
data-validate="{'validate-grouped-qty':'#super-product-table'}"
data-errors-message-box="#validation-message-box"/>

<button title="Add to Cart" class="addtocart" onclick="window.forms.product_addtocart_form_6749.submit()">
Add to Cart
</button>

</form>
<form action="https://magento2.petpanic.gr/checkout/cart/add/uenc/aHR0cHM6Ly9tYWdlbnRvMi5wZXRwYW5pYy5nci9za3Vsb2kvYW50aXBhcmFzaXRpa2EtZ2lhLXNrdWxpYS9hbXBvdWxlcy9hbXBvdWxlcy1za3Vsb3UtYW50aXBobGVib3RvbWUtc3BvdC1vbi5odG1s/product/6749/" method="post" id="product_addtocart_form_6749" novalidate="novalidate">
<input type="hidden" name="product" value="6749">
<input type="hidden" name="related_product" id="related-products-field" value="">
<input name="form_key" type="hidden" value="WZFyhGEmonXLbFmp">
</form>

<!--button type="button" onclick="setLocation('<?php //echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + $(this).previous().value)">Add to cart</button-->
</div>

<?php else: ?>
<div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
<span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
</div>
<?php endif; ?>
</td>
<td class="addtocart">
<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
$addToCartUrl = $listBlock->getAddToCartUrl($_item);
?>
<?php /*
<form data-role="tocart-form" action="<?php echo $addToCartUrl; ?>" method="post">
<?php echo $block->getBlockHtml('formkey')?>
<button type="submit" title="Add to Cart" class="addtocart">
Add to Cart
</button>

</form> */ ?>
</td>

<?php endif; ?>
</tr>
<?php if ($block->getCanShowProductPrice($_product)
&& $block->getCanShowProductPrice($_item)
&& trim($block->getProductPriceHtml(
$_item,
MagentoCatalogPricingPriceTierPrice::PRICE_CODE
))): ?>
<tr class="row-tier-price">
<td colspan="2">
<?= $block->getProductPriceHtml(
$_item,
MagentoCatalogPricingPriceTierPrice::PRICE_CODE
) ?>
</td>
</tr>
<?php endif; ?>
</tbody>
<?php endforeach; ?>
<?php else: ?>
<tbody>
<tr>
<td class="unavailable"
colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
<?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
</td>
</tr>
</tbody>
<?php endif; ?>
</table>
</div>
<div id="validation-message-box"></div>


I am currently new in Magento, also I tried many solutions but nothing gonna work for me. If there is any solution for this please let me know!
Thanks in advanced!










share|improve this question































    3















    I have two simple products associated with a group product at the product description page and have a separate add to cart button with each product I want to add these products to the cart individually But I am unable to When I press the first product to add to cart button both products are added to the cart. You can check the scenario by the following this link



    this is my **group.phtml** file

    <?php
    /**
    * Copyright © Magento, Inc. All rights reserved.
    * See COPYING.txt for license details.
    */

    // @codingStandardsIgnoreFile

    /**
    * Grouped product data template
    *
    * @var $block MagentoCatalogBlockProductViewBaseImage
    * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
    */
    ?>
    <?php $block->setPreconfiguredValue(); ?>
    <?php $_product = $block->getProduct(); ?>
    <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
    <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
    <?php $grouped = $_product->load($_product->getId()); ?>
    <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

    <div class="table-wrapper grouped">
    <table class="table data grouped" id="super-product-table">
    <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
    <thead>
    <tr>
    <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
    <?php if ($_product->isSaleable()): ?>
    <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
    <?php endif; ?>
    </tr>
    </thead>

    <?php if ($_hasAssociatedProducts): ?>
    <?php foreach ($associatedProducts as $_item): ?>
    <tbody>
    <tr>
    <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
    <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
    <?php if ($block->getCanShowProductPrice($_product)): ?>
    <?php if ($block->getCanShowProductPrice($_item)): ?>
    <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
    <?php endif; ?>
    <?php endif; ?>
    </td>
    <?php if ($_product->isSaleable()): ?>
    <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
    <?php if ($_item->isSaleable()) : ?>
    <div class="control qty">
    <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
    <?php echo $block->getBlockHtml('formkey')?>
    <input type="number"
    name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
    data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
    value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
    title="<?= /* @escapeNotVerified */ __('Qty') ?>"
    class="input-text qty"
    data-validate="{'validate-grouped-qty':'#super-product-table'}"
    data-errors-message-box="#validation-message-box"/>

    <button title="Add to Cart" class="addtocart" onclick="window.forms.product_addtocart_form_6749.submit()">
    Add to Cart
    </button>

    </form>
    <form action="https://magento2.petpanic.gr/checkout/cart/add/uenc/aHR0cHM6Ly9tYWdlbnRvMi5wZXRwYW5pYy5nci9za3Vsb2kvYW50aXBhcmFzaXRpa2EtZ2lhLXNrdWxpYS9hbXBvdWxlcy9hbXBvdWxlcy1za3Vsb3UtYW50aXBobGVib3RvbWUtc3BvdC1vbi5odG1s/product/6749/" method="post" id="product_addtocart_form_6749" novalidate="novalidate">
    <input type="hidden" name="product" value="6749">
    <input type="hidden" name="related_product" id="related-products-field" value="">
    <input name="form_key" type="hidden" value="WZFyhGEmonXLbFmp">
    </form>

    <!--button type="button" onclick="setLocation('<?php //echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + $(this).previous().value)">Add to cart</button-->
    </div>

    <?php else: ?>
    <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
    <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
    </div>
    <?php endif; ?>
    </td>
    <td class="addtocart">
    <?php
    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
    $addToCartUrl = $listBlock->getAddToCartUrl($_item);
    ?>
    <?php /*
    <form data-role="tocart-form" action="<?php echo $addToCartUrl; ?>" method="post">
    <?php echo $block->getBlockHtml('formkey')?>
    <button type="submit" title="Add to Cart" class="addtocart">
    Add to Cart
    </button>

    </form> */ ?>
    </td>

    <?php endif; ?>
    </tr>
    <?php if ($block->getCanShowProductPrice($_product)
    && $block->getCanShowProductPrice($_item)
    && trim($block->getProductPriceHtml(
    $_item,
    MagentoCatalogPricingPriceTierPrice::PRICE_CODE
    ))): ?>
    <tr class="row-tier-price">
    <td colspan="2">
    <?= $block->getProductPriceHtml(
    $_item,
    MagentoCatalogPricingPriceTierPrice::PRICE_CODE
    ) ?>
    </td>
    </tr>
    <?php endif; ?>
    </tbody>
    <?php endforeach; ?>
    <?php else: ?>
    <tbody>
    <tr>
    <td class="unavailable"
    colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
    <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
    </td>
    </tr>
    </tbody>
    <?php endif; ?>
    </table>
    </div>
    <div id="validation-message-box"></div>


    I am currently new in Magento, also I tried many solutions but nothing gonna work for me. If there is any solution for this please let me know!
    Thanks in advanced!










    share|improve this question



























      3












      3








      3


      2






      I have two simple products associated with a group product at the product description page and have a separate add to cart button with each product I want to add these products to the cart individually But I am unable to When I press the first product to add to cart button both products are added to the cart. You can check the scenario by the following this link



      this is my **group.phtml** file

      <?php
      /**
      * Copyright © Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */

      // @codingStandardsIgnoreFile

      /**
      * Grouped product data template
      *
      * @var $block MagentoCatalogBlockProductViewBaseImage
      * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
      */
      ?>
      <?php $block->setPreconfiguredValue(); ?>
      <?php $_product = $block->getProduct(); ?>
      <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
      <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
      <?php $grouped = $_product->load($_product->getId()); ?>
      <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

      <div class="table-wrapper grouped">
      <table class="table data grouped" id="super-product-table">
      <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
      <thead>
      <tr>
      <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
      <?php if ($_product->isSaleable()): ?>
      <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
      <?php endif; ?>
      </tr>
      </thead>

      <?php if ($_hasAssociatedProducts): ?>
      <?php foreach ($associatedProducts as $_item): ?>
      <tbody>
      <tr>
      <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
      <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
      <?php if ($block->getCanShowProductPrice($_product)): ?>
      <?php if ($block->getCanShowProductPrice($_item)): ?>
      <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
      <?php endif; ?>
      <?php endif; ?>
      </td>
      <?php if ($_product->isSaleable()): ?>
      <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
      <?php if ($_item->isSaleable()) : ?>
      <div class="control qty">
      <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
      <?php echo $block->getBlockHtml('formkey')?>
      <input type="number"
      name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
      data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
      value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
      title="<?= /* @escapeNotVerified */ __('Qty') ?>"
      class="input-text qty"
      data-validate="{'validate-grouped-qty':'#super-product-table'}"
      data-errors-message-box="#validation-message-box"/>

      <button title="Add to Cart" class="addtocart" onclick="window.forms.product_addtocart_form_6749.submit()">
      Add to Cart
      </button>

      </form>
      <form action="https://magento2.petpanic.gr/checkout/cart/add/uenc/aHR0cHM6Ly9tYWdlbnRvMi5wZXRwYW5pYy5nci9za3Vsb2kvYW50aXBhcmFzaXRpa2EtZ2lhLXNrdWxpYS9hbXBvdWxlcy9hbXBvdWxlcy1za3Vsb3UtYW50aXBobGVib3RvbWUtc3BvdC1vbi5odG1s/product/6749/" method="post" id="product_addtocart_form_6749" novalidate="novalidate">
      <input type="hidden" name="product" value="6749">
      <input type="hidden" name="related_product" id="related-products-field" value="">
      <input name="form_key" type="hidden" value="WZFyhGEmonXLbFmp">
      </form>

      <!--button type="button" onclick="setLocation('<?php //echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + $(this).previous().value)">Add to cart</button-->
      </div>

      <?php else: ?>
      <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
      <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
      </div>
      <?php endif; ?>
      </td>
      <td class="addtocart">
      <?php
      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
      $addToCartUrl = $listBlock->getAddToCartUrl($_item);
      ?>
      <?php /*
      <form data-role="tocart-form" action="<?php echo $addToCartUrl; ?>" method="post">
      <?php echo $block->getBlockHtml('formkey')?>
      <button type="submit" title="Add to Cart" class="addtocart">
      Add to Cart
      </button>

      </form> */ ?>
      </td>

      <?php endif; ?>
      </tr>
      <?php if ($block->getCanShowProductPrice($_product)
      && $block->getCanShowProductPrice($_item)
      && trim($block->getProductPriceHtml(
      $_item,
      MagentoCatalogPricingPriceTierPrice::PRICE_CODE
      ))): ?>
      <tr class="row-tier-price">
      <td colspan="2">
      <?= $block->getProductPriceHtml(
      $_item,
      MagentoCatalogPricingPriceTierPrice::PRICE_CODE
      ) ?>
      </td>
      </tr>
      <?php endif; ?>
      </tbody>
      <?php endforeach; ?>
      <?php else: ?>
      <tbody>
      <tr>
      <td class="unavailable"
      colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
      <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
      </td>
      </tr>
      </tbody>
      <?php endif; ?>
      </table>
      </div>
      <div id="validation-message-box"></div>


      I am currently new in Magento, also I tried many solutions but nothing gonna work for me. If there is any solution for this please let me know!
      Thanks in advanced!










      share|improve this question
















      I have two simple products associated with a group product at the product description page and have a separate add to cart button with each product I want to add these products to the cart individually But I am unable to When I press the first product to add to cart button both products are added to the cart. You can check the scenario by the following this link



      this is my **group.phtml** file

      <?php
      /**
      * Copyright © Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */

      // @codingStandardsIgnoreFile

      /**
      * Grouped product data template
      *
      * @var $block MagentoCatalogBlockProductViewBaseImage
      * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
      */
      ?>
      <?php $block->setPreconfiguredValue(); ?>
      <?php $_product = $block->getProduct(); ?>
      <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
      <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
      <?php $grouped = $_product->load($_product->getId()); ?>
      <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

      <div class="table-wrapper grouped">
      <table class="table data grouped" id="super-product-table">
      <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
      <thead>
      <tr>
      <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
      <?php if ($_product->isSaleable()): ?>
      <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
      <?php endif; ?>
      </tr>
      </thead>

      <?php if ($_hasAssociatedProducts): ?>
      <?php foreach ($associatedProducts as $_item): ?>
      <tbody>
      <tr>
      <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
      <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
      <?php if ($block->getCanShowProductPrice($_product)): ?>
      <?php if ($block->getCanShowProductPrice($_item)): ?>
      <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
      <?php endif; ?>
      <?php endif; ?>
      </td>
      <?php if ($_product->isSaleable()): ?>
      <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
      <?php if ($_item->isSaleable()) : ?>
      <div class="control qty">
      <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
      <?php echo $block->getBlockHtml('formkey')?>
      <input type="number"
      name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
      data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
      value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
      title="<?= /* @escapeNotVerified */ __('Qty') ?>"
      class="input-text qty"
      data-validate="{'validate-grouped-qty':'#super-product-table'}"
      data-errors-message-box="#validation-message-box"/>

      <button title="Add to Cart" class="addtocart" onclick="window.forms.product_addtocart_form_6749.submit()">
      Add to Cart
      </button>

      </form>
      <form action="https://magento2.petpanic.gr/checkout/cart/add/uenc/aHR0cHM6Ly9tYWdlbnRvMi5wZXRwYW5pYy5nci9za3Vsb2kvYW50aXBhcmFzaXRpa2EtZ2lhLXNrdWxpYS9hbXBvdWxlcy9hbXBvdWxlcy1za3Vsb3UtYW50aXBobGVib3RvbWUtc3BvdC1vbi5odG1s/product/6749/" method="post" id="product_addtocart_form_6749" novalidate="novalidate">
      <input type="hidden" name="product" value="6749">
      <input type="hidden" name="related_product" id="related-products-field" value="">
      <input name="form_key" type="hidden" value="WZFyhGEmonXLbFmp">
      </form>

      <!--button type="button" onclick="setLocation('<?php //echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + $(this).previous().value)">Add to cart</button-->
      </div>

      <?php else: ?>
      <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
      <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
      </div>
      <?php endif; ?>
      </td>
      <td class="addtocart">
      <?php
      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
      $addToCartUrl = $listBlock->getAddToCartUrl($_item);
      ?>
      <?php /*
      <form data-role="tocart-form" action="<?php echo $addToCartUrl; ?>" method="post">
      <?php echo $block->getBlockHtml('formkey')?>
      <button type="submit" title="Add to Cart" class="addtocart">
      Add to Cart
      </button>

      </form> */ ?>
      </td>

      <?php endif; ?>
      </tr>
      <?php if ($block->getCanShowProductPrice($_product)
      && $block->getCanShowProductPrice($_item)
      && trim($block->getProductPriceHtml(
      $_item,
      MagentoCatalogPricingPriceTierPrice::PRICE_CODE
      ))): ?>
      <tr class="row-tier-price">
      <td colspan="2">
      <?= $block->getProductPriceHtml(
      $_item,
      MagentoCatalogPricingPriceTierPrice::PRICE_CODE
      ) ?>
      </td>
      </tr>
      <?php endif; ?>
      </tbody>
      <?php endforeach; ?>
      <?php else: ?>
      <tbody>
      <tr>
      <td class="unavailable"
      colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
      <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
      </td>
      </tr>
      </tbody>
      <?php endif; ?>
      </table>
      </div>
      <div id="validation-message-box"></div>


      I am currently new in Magento, also I tried many solutions but nothing gonna work for me. If there is any solution for this please let me know!
      Thanks in advanced!







      magento2 catalog grouped-products






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 16 hours ago







      shweta mudgil

















      asked 21 hours ago









      shweta mudgilshweta mudgil

      255




      255






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Try below code. It should work.



          <?php
          /**
          * Copyright © Magento, Inc. All rights reserved.
          * See COPYING.txt for license details.
          */

          // @codingStandardsIgnoreFile

          /**
          * Grouped product data template
          *
          * @var $block MagentoCatalogBlockProductViewBaseImage
          * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
          */
          ?>
          <?php $block->setPreconfiguredValue(); ?>
          <?php $_product = $block->getProduct(); ?>
          <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
          <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
          <?php $grouped = $_product->load($_product->getId()); ?>
          <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

          </form>

          <div class="table-wrapper grouped">
          <table class="table data grouped" id="super-product-table">
          <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
          <thead>
          <tr>
          <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
          <?php if ($_product->isSaleable()): ?>
          <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
          <?php endif; ?>
          </tr>
          </thead>

          <?php if ($_hasAssociatedProducts): ?>
          <?php foreach ($associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
          <input type="hidden" name="product" value="<?php echo $_item->getId(); ?>">
          <input type="hidden" name="related_product" id="related-products-field" value="">
          <input type="number"
          name="qty"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty required"
          />

          <?php echo $block->getBlockHtml('formkey')?>

          <!--
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          -->
          <button type="submit" title="Add to Cart" class="addtocart">Add to Cart</button>
          </form>
          </div>

          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <td class="addtocart">
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>
          <?php else: ?>
          <tbody>
          <tr>
          <td class="unavailable"
          colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
          <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
          </td>
          </tr>
          </tbody>
          <?php endif; ?>
          </table>
          </div>
          <div id="validation-message-box"></div>

          <form>


          Please note that this code will not add group product to cart, only simple product associated with group will be added as per your theme.






          share|improve this answer


























          • Did not work. :(

            – shweta mudgil
            17 hours ago











          • Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

            – Yash Shah
            16 hours ago











          • Don't know what to do.

            – shweta mudgil
            16 hours ago











          • Can you please share the code you applied ? The exact one ? After my suggested changes ?

            – Yash Shah
            16 hours ago













          • Actually @yash second add to cart button worked properly but first one creating the problem.

            – shweta mudgil
            16 hours ago



















          1














          As far I Understood by looking at your shared link, you have set the default quantity of the simple products to 1 of Group product. In that case when user click on Add to cart button it will automatically add all simple product products of grouped product. First you need to set it to 0. So it will add only those simple products which has quantity greater than 0 when user click on the Add to Cart button. For Reference please see the screenshot



          enter image description here



          It is not possible or I would rather say against the nature of magento to add simple products of grouped product in isolation. if you want to treat simple product individually why you made a part of these product as a grouped product then there is no meaning of grouped product.



          Or if you really want to do that, replace my code with your one



          <?php foreach ($_associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          </div>
          <button type="button" onclick="window.location='<?php echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + jQuery(this).prev().children().val()">Add to cart</button>
          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>


          I hope you got my point and it will help






          share|improve this answer


























          • Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

            – shweta mudgil
            20 hours ago













          • I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

            – Muhammad Hasham
            20 hours ago













          • So according to you, there is no way to add them individually with individually add to cart button?

            – shweta mudgil
            20 hours ago











          • Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

            – Muhammad Hasham
            20 hours ago













          • last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

            – shweta mudgil
            20 hours ago












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270767%2fhow-to-add-group-product-into-the-cart-individually%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Try below code. It should work.



          <?php
          /**
          * Copyright © Magento, Inc. All rights reserved.
          * See COPYING.txt for license details.
          */

          // @codingStandardsIgnoreFile

          /**
          * Grouped product data template
          *
          * @var $block MagentoCatalogBlockProductViewBaseImage
          * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
          */
          ?>
          <?php $block->setPreconfiguredValue(); ?>
          <?php $_product = $block->getProduct(); ?>
          <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
          <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
          <?php $grouped = $_product->load($_product->getId()); ?>
          <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

          </form>

          <div class="table-wrapper grouped">
          <table class="table data grouped" id="super-product-table">
          <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
          <thead>
          <tr>
          <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
          <?php if ($_product->isSaleable()): ?>
          <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
          <?php endif; ?>
          </tr>
          </thead>

          <?php if ($_hasAssociatedProducts): ?>
          <?php foreach ($associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
          <input type="hidden" name="product" value="<?php echo $_item->getId(); ?>">
          <input type="hidden" name="related_product" id="related-products-field" value="">
          <input type="number"
          name="qty"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty required"
          />

          <?php echo $block->getBlockHtml('formkey')?>

          <!--
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          -->
          <button type="submit" title="Add to Cart" class="addtocart">Add to Cart</button>
          </form>
          </div>

          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <td class="addtocart">
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>
          <?php else: ?>
          <tbody>
          <tr>
          <td class="unavailable"
          colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
          <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
          </td>
          </tr>
          </tbody>
          <?php endif; ?>
          </table>
          </div>
          <div id="validation-message-box"></div>

          <form>


          Please note that this code will not add group product to cart, only simple product associated with group will be added as per your theme.






          share|improve this answer


























          • Did not work. :(

            – shweta mudgil
            17 hours ago











          • Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

            – Yash Shah
            16 hours ago











          • Don't know what to do.

            – shweta mudgil
            16 hours ago











          • Can you please share the code you applied ? The exact one ? After my suggested changes ?

            – Yash Shah
            16 hours ago













          • Actually @yash second add to cart button worked properly but first one creating the problem.

            – shweta mudgil
            16 hours ago
















          1














          Try below code. It should work.



          <?php
          /**
          * Copyright © Magento, Inc. All rights reserved.
          * See COPYING.txt for license details.
          */

          // @codingStandardsIgnoreFile

          /**
          * Grouped product data template
          *
          * @var $block MagentoCatalogBlockProductViewBaseImage
          * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
          */
          ?>
          <?php $block->setPreconfiguredValue(); ?>
          <?php $_product = $block->getProduct(); ?>
          <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
          <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
          <?php $grouped = $_product->load($_product->getId()); ?>
          <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

          </form>

          <div class="table-wrapper grouped">
          <table class="table data grouped" id="super-product-table">
          <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
          <thead>
          <tr>
          <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
          <?php if ($_product->isSaleable()): ?>
          <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
          <?php endif; ?>
          </tr>
          </thead>

          <?php if ($_hasAssociatedProducts): ?>
          <?php foreach ($associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
          <input type="hidden" name="product" value="<?php echo $_item->getId(); ?>">
          <input type="hidden" name="related_product" id="related-products-field" value="">
          <input type="number"
          name="qty"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty required"
          />

          <?php echo $block->getBlockHtml('formkey')?>

          <!--
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          -->
          <button type="submit" title="Add to Cart" class="addtocart">Add to Cart</button>
          </form>
          </div>

          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <td class="addtocart">
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>
          <?php else: ?>
          <tbody>
          <tr>
          <td class="unavailable"
          colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
          <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
          </td>
          </tr>
          </tbody>
          <?php endif; ?>
          </table>
          </div>
          <div id="validation-message-box"></div>

          <form>


          Please note that this code will not add group product to cart, only simple product associated with group will be added as per your theme.






          share|improve this answer


























          • Did not work. :(

            – shweta mudgil
            17 hours ago











          • Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

            – Yash Shah
            16 hours ago











          • Don't know what to do.

            – shweta mudgil
            16 hours ago











          • Can you please share the code you applied ? The exact one ? After my suggested changes ?

            – Yash Shah
            16 hours ago













          • Actually @yash second add to cart button worked properly but first one creating the problem.

            – shweta mudgil
            16 hours ago














          1












          1








          1







          Try below code. It should work.



          <?php
          /**
          * Copyright © Magento, Inc. All rights reserved.
          * See COPYING.txt for license details.
          */

          // @codingStandardsIgnoreFile

          /**
          * Grouped product data template
          *
          * @var $block MagentoCatalogBlockProductViewBaseImage
          * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
          */
          ?>
          <?php $block->setPreconfiguredValue(); ?>
          <?php $_product = $block->getProduct(); ?>
          <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
          <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
          <?php $grouped = $_product->load($_product->getId()); ?>
          <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

          </form>

          <div class="table-wrapper grouped">
          <table class="table data grouped" id="super-product-table">
          <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
          <thead>
          <tr>
          <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
          <?php if ($_product->isSaleable()): ?>
          <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
          <?php endif; ?>
          </tr>
          </thead>

          <?php if ($_hasAssociatedProducts): ?>
          <?php foreach ($associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
          <input type="hidden" name="product" value="<?php echo $_item->getId(); ?>">
          <input type="hidden" name="related_product" id="related-products-field" value="">
          <input type="number"
          name="qty"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty required"
          />

          <?php echo $block->getBlockHtml('formkey')?>

          <!--
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          -->
          <button type="submit" title="Add to Cart" class="addtocart">Add to Cart</button>
          </form>
          </div>

          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <td class="addtocart">
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>
          <?php else: ?>
          <tbody>
          <tr>
          <td class="unavailable"
          colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
          <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
          </td>
          </tr>
          </tbody>
          <?php endif; ?>
          </table>
          </div>
          <div id="validation-message-box"></div>

          <form>


          Please note that this code will not add group product to cart, only simple product associated with group will be added as per your theme.






          share|improve this answer















          Try below code. It should work.



          <?php
          /**
          * Copyright © Magento, Inc. All rights reserved.
          * See COPYING.txt for license details.
          */

          // @codingStandardsIgnoreFile

          /**
          * Grouped product data template
          *
          * @var $block MagentoCatalogBlockProductViewBaseImage
          * @var $block MagentoGroupedProductBlockProductViewTypeGrouped
          */
          ?>
          <?php $block->setPreconfiguredValue(); ?>
          <?php $_product = $block->getProduct(); ?>
          <?php $_associatedProducts = $block->getAssociatedProducts(); ?>
          <?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
          <?php $grouped = $_product->load($_product->getId()); ?>
          <?php $associatedProducts = $grouped->getTypeInstance()->getAssociatedProducts($grouped); ?>

          </form>

          <div class="table-wrapper grouped">
          <table class="table data grouped" id="super-product-table">
          <caption class="table-caption"><?= /* @escapeNotVerified */ __('Grouped product items') ?></caption>
          <thead>
          <tr>
          <th class="col item" scope="col"><?= /* @escapeNotVerified */ __('Product Name') ?></th>
          <?php if ($_product->isSaleable()): ?>
          <th class="col qty" scope="col"><?= /* @escapeNotVerified */ __('Qty') ?></th>
          <?php endif; ?>
          </tr>
          </thead>

          <?php if ($_hasAssociatedProducts): ?>
          <?php foreach ($associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <form data-role="tocart-form" action="<?php echo $this->getAddToCartUrl($_item); ?>" method="post">
          <input type="hidden" name="product" value="<?php echo $_item->getId(); ?>">
          <input type="hidden" name="related_product" id="related-products-field" value="">
          <input type="number"
          name="qty"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty required"
          />

          <?php echo $block->getBlockHtml('formkey')?>

          <!--
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          -->
          <button type="submit" title="Add to Cart" class="addtocart">Add to Cart</button>
          </form>
          </div>

          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <td class="addtocart">
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>
          <?php else: ?>
          <tbody>
          <tr>
          <td class="unavailable"
          colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>">
          <?= /* @escapeNotVerified */ __('No options of this product are available.') ?>
          </td>
          </tr>
          </tbody>
          <?php endif; ?>
          </table>
          </div>
          <div id="validation-message-box"></div>

          <form>


          Please note that this code will not add group product to cart, only simple product associated with group will be added as per your theme.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 16 hours ago

























          answered 17 hours ago









          Yash ShahYash Shah

          90118




          90118













          • Did not work. :(

            – shweta mudgil
            17 hours ago











          • Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

            – Yash Shah
            16 hours ago











          • Don't know what to do.

            – shweta mudgil
            16 hours ago











          • Can you please share the code you applied ? The exact one ? After my suggested changes ?

            – Yash Shah
            16 hours ago













          • Actually @yash second add to cart button worked properly but first one creating the problem.

            – shweta mudgil
            16 hours ago



















          • Did not work. :(

            – shweta mudgil
            17 hours ago











          • Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

            – Yash Shah
            16 hours ago











          • Don't know what to do.

            – shweta mudgil
            16 hours ago











          • Can you please share the code you applied ? The exact one ? After my suggested changes ?

            – Yash Shah
            16 hours ago













          • Actually @yash second add to cart button worked properly but first one creating the problem.

            – shweta mudgil
            16 hours ago

















          Did not work. :(

          – shweta mudgil
          17 hours ago





          Did not work. :(

          – shweta mudgil
          17 hours ago













          Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

          – Yash Shah
          16 hours ago





          Ohh strange. I just checked it in your website creating the same form in inspect element and it worked for me actually. Your simple product added for me to cart.

          – Yash Shah
          16 hours ago













          Don't know what to do.

          – shweta mudgil
          16 hours ago





          Don't know what to do.

          – shweta mudgil
          16 hours ago













          Can you please share the code you applied ? The exact one ? After my suggested changes ?

          – Yash Shah
          16 hours ago







          Can you please share the code you applied ? The exact one ? After my suggested changes ?

          – Yash Shah
          16 hours ago















          Actually @yash second add to cart button worked properly but first one creating the problem.

          – shweta mudgil
          16 hours ago





          Actually @yash second add to cart button worked properly but first one creating the problem.

          – shweta mudgil
          16 hours ago













          1














          As far I Understood by looking at your shared link, you have set the default quantity of the simple products to 1 of Group product. In that case when user click on Add to cart button it will automatically add all simple product products of grouped product. First you need to set it to 0. So it will add only those simple products which has quantity greater than 0 when user click on the Add to Cart button. For Reference please see the screenshot



          enter image description here



          It is not possible or I would rather say against the nature of magento to add simple products of grouped product in isolation. if you want to treat simple product individually why you made a part of these product as a grouped product then there is no meaning of grouped product.



          Or if you really want to do that, replace my code with your one



          <?php foreach ($_associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          </div>
          <button type="button" onclick="window.location='<?php echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + jQuery(this).prev().children().val()">Add to cart</button>
          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>


          I hope you got my point and it will help






          share|improve this answer


























          • Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

            – shweta mudgil
            20 hours ago













          • I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

            – Muhammad Hasham
            20 hours ago













          • So according to you, there is no way to add them individually with individually add to cart button?

            – shweta mudgil
            20 hours ago











          • Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

            – Muhammad Hasham
            20 hours ago













          • last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

            – shweta mudgil
            20 hours ago
















          1














          As far I Understood by looking at your shared link, you have set the default quantity of the simple products to 1 of Group product. In that case when user click on Add to cart button it will automatically add all simple product products of grouped product. First you need to set it to 0. So it will add only those simple products which has quantity greater than 0 when user click on the Add to Cart button. For Reference please see the screenshot



          enter image description here



          It is not possible or I would rather say against the nature of magento to add simple products of grouped product in isolation. if you want to treat simple product individually why you made a part of these product as a grouped product then there is no meaning of grouped product.



          Or if you really want to do that, replace my code with your one



          <?php foreach ($_associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          </div>
          <button type="button" onclick="window.location='<?php echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + jQuery(this).prev().children().val()">Add to cart</button>
          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>


          I hope you got my point and it will help






          share|improve this answer


























          • Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

            – shweta mudgil
            20 hours ago













          • I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

            – Muhammad Hasham
            20 hours ago













          • So according to you, there is no way to add them individually with individually add to cart button?

            – shweta mudgil
            20 hours ago











          • Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

            – Muhammad Hasham
            20 hours ago













          • last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

            – shweta mudgil
            20 hours ago














          1












          1








          1







          As far I Understood by looking at your shared link, you have set the default quantity of the simple products to 1 of Group product. In that case when user click on Add to cart button it will automatically add all simple product products of grouped product. First you need to set it to 0. So it will add only those simple products which has quantity greater than 0 when user click on the Add to Cart button. For Reference please see the screenshot



          enter image description here



          It is not possible or I would rather say against the nature of magento to add simple products of grouped product in isolation. if you want to treat simple product individually why you made a part of these product as a grouped product then there is no meaning of grouped product.



          Or if you really want to do that, replace my code with your one



          <?php foreach ($_associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          </div>
          <button type="button" onclick="window.location='<?php echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + jQuery(this).prev().children().val()">Add to cart</button>
          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>


          I hope you got my point and it will help






          share|improve this answer















          As far I Understood by looking at your shared link, you have set the default quantity of the simple products to 1 of Group product. In that case when user click on Add to cart button it will automatically add all simple product products of grouped product. First you need to set it to 0. So it will add only those simple products which has quantity greater than 0 when user click on the Add to Cart button. For Reference please see the screenshot



          enter image description here



          It is not possible or I would rather say against the nature of magento to add simple products of grouped product in isolation. if you want to treat simple product individually why you made a part of these product as a grouped product then there is no meaning of grouped product.



          Or if you really want to do that, replace my code with your one



          <?php foreach ($_associatedProducts as $_item): ?>
          <tbody>
          <tr>
          <td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
          <strong class="product-item-name"><?= $block->escapeHtml($_item->getName()) ?></strong>
          <?php if ($block->getCanShowProductPrice($_product)): ?>
          <?php if ($block->getCanShowProductPrice($_item)): ?>
          <?= /* @escapeNotVerified */ $block->getProductPrice($_item) ?>
          <?php endif; ?>
          <?php endif; ?>
          </td>
          <?php if ($_product->isSaleable()): ?>
          <td data-th="<?= $block->escapeHtml(__('Qty')) ?>" class="col qty">
          <?php if ($_item->isSaleable()) : ?>
          <div class="control qty">
          <input type="number"
          name="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          data-selector="super_group[<?= /* @escapeNotVerified */ $_item->getId() ?>]"
          value="<?= /* @escapeNotVerified */ $_item->getQty() * 1 ?>"
          title="<?= /* @escapeNotVerified */ __('Qty') ?>"
          class="input-text qty"
          data-validate="{'validate-grouped-qty':'#super-product-table'}"
          data-errors-message-box="#validation-message-box"/>
          </div>
          <button type="button" onclick="window.location='<?php echo $this->getAddToCartUrl($_item) ?>' + 'qty/' + jQuery(this).prev().children().val()">Add to cart</button>
          <?php else: ?>
          <div class="stock unavailable" title="<?= /* @escapeNotVerified */ __('Availability') ?>">
          <span><?= /* @escapeNotVerified */ __('Out of stock') ?></span>
          </div>
          <?php endif; ?>
          </td>
          <?php endif; ?>
          </tr>
          <?php if ($block->getCanShowProductPrice($_product)
          && $block->getCanShowProductPrice($_item)
          && trim($block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ))): ?>
          <tr class="row-tier-price">
          <td colspan="2">
          <?= $block->getProductPriceHtml(
          $_item,
          MagentoCatalogPricingPriceTierPrice::PRICE_CODE
          ) ?>
          </td>
          </tr>
          <?php endif; ?>
          </tbody>
          <?php endforeach; ?>


          I hope you got my point and it will help







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 18 hours ago

























          answered 20 hours ago









          Muhammad HashamMuhammad Hasham

          2,9612931




          2,9612931













          • Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

            – shweta mudgil
            20 hours ago













          • I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

            – Muhammad Hasham
            20 hours ago













          • So according to you, there is no way to add them individually with individually add to cart button?

            – shweta mudgil
            20 hours ago











          • Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

            – Muhammad Hasham
            20 hours ago













          • last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

            – shweta mudgil
            20 hours ago



















          • Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

            – shweta mudgil
            20 hours ago













          • I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

            – Muhammad Hasham
            20 hours ago













          • So according to you, there is no way to add them individually with individually add to cart button?

            – shweta mudgil
            20 hours ago











          • Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

            – Muhammad Hasham
            20 hours ago













          • last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

            – shweta mudgil
            20 hours ago

















          Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

          – shweta mudgil
          20 hours ago







          Half work is done by the previous developer! That's why I am getting the problem If you check the link below addtocart working fine as it adds only one product But I am unable to do this with the first product

          – shweta mudgil
          20 hours ago















          I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

          – Muhammad Hasham
          20 hours ago







          I checked, it will add both simple products to cart that's same thing I wrote on my answer. if you want to add him separately you don't need to add multiple add to cart button against each product. single button would done a job because it's a grouped product you just need to define other product quantity to 0 which you don't want to add it to cart.

          – Muhammad Hasham
          20 hours ago















          So according to you, there is no way to add them individually with individually add to cart button?

          – shweta mudgil
          20 hours ago





          So according to you, there is no way to add them individually with individually add to cart button?

          – shweta mudgil
          20 hours ago













          Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

          – Muhammad Hasham
          20 hours ago







          Yes because it is against the nature of Magento grouped product working flow. logically if it is possible then why these products are the part of grouped product and why not it will show as a individual simple product. For Reference check magento documentation: docs.magento.com/m2/ce/user_guide/catalog/…

          – Muhammad Hasham
          20 hours ago















          last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

          – shweta mudgil
          20 hours ago





          last question why I am able to add them here individually magento2.petpanic.gr/skuloi/xira-trofi-skulon/…

          – shweta mudgil
          20 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270767%2fhow-to-add-group-product-into-the-cart-individually%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          數位音樂下載

          When can things happen in Etherscan, such as the picture below?

          格利澤436b