Skip to content

Commit 934b1b2

Browse files
committed
MC-39107: [MAGENTO CLOUD] Page refresh on add to cart from product block
1 parent d3d9fbe commit 934b1b2

File tree

1 file changed

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

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ use Magento\Framework\App\Action\Action;
7272
<?= $block->getBlockHtml('formkey') ?>
7373
<button type="submit"
7474
title="<?= $block->escapeHtml(__('Add to Cart')) ?>"
75-
class="action tocart primary"
76-
disabled>
75+
class="action tocart primary">
7776
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
7877
</button>
7978
</form>
@@ -114,11 +113,13 @@ use Magento\Framework\App\Action\Action;
114113
<?= $block->getPagerHtml() ?>
115114
</div>
116115
</div>
117-
<script type="text/x-magento-init">
118-
{
119-
".block.widget [data-role=tocart-form]": {
120-
"Magento_Catalog/js/validate-product": {}
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+
}
121122
}
122-
}
123-
</script>
123+
</script>
124+
<?php endif;?>
124125
<?php endif;?>

0 commit comments

Comments
 (0)