Skip to content

Commit 4e6dbf3

Browse files
committed
ACP2E-1564: Page Builder: Adding Product to cart from PB Grid/Carousel doubles up the item quantity
1 parent c82c795 commit 4e6dbf3

File tree

1 file changed

+18
-9
lines changed
  • app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content

1 file changed

+18
-9
lines changed

app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ use Magento\Framework\App\Action\Action;
1111
// phpcs:disable Generic.Files.LineLength.TooLong
1212
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
1313
?>
14+
15+
<?php
16+
/**
17+
* Product carousel widget template
18+
*
19+
* @var \Magento\Framework\Escaper $escaper
20+
*/
21+
?>
22+
1423
<?php if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())): ?>
1524
<?php
1625
$type = 'widget-product-grid';
@@ -76,6 +85,15 @@ use Magento\Framework\App\Action\Action;
7685
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
7786
</button>
7887
</form>
88+
<script type="text/x-magento-init">
89+
{
90+
"[data-role=tocart-form], .form.map.checkout": {
91+
"catalogAddToCart": {
92+
"product_sku": "<?= $escaper->escapeJs($_item->getSku()); ?>"
93+
}
94+
}
95+
}
96+
</script>
7997
<?php else: ?>
8098
<?php if ($_item->isAvailable()): ?>
8199
<div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
@@ -113,13 +131,4 @@ use Magento\Framework\App\Action\Action;
113131
<?= $block->getPagerHtml() ?>
114132
</div>
115133
</div>
116-
<?php if($block->getBlockHtml('formkey')): ?>
117-
<script type="text/x-magento-init">
118-
{
119-
".block.widget [data-role=tocart-form]": {
120-
"Magento_Catalog/js/validate-product": {}
121-
}
122-
}
123-
</script>
124-
<?php endif;?>
125134
<?php endif;?>

0 commit comments

Comments
 (0)