I have develop custom module that can update add to cart and update cart button but I can`t update Update cart button
I have update Add to Cart button using catalog_product_view.xml
<referenceBlock name="product.info.addtocart">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Customproduct::catalog/product/view/addtocart.phtml</argument>
</action>
</referenceBlock>
<referenceBlock name="product.info.addtocart.additional">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Customproduct::catalog/product/view/addtocart.phtml</argument>
</action>
</referenceBlock>
I have try to update update cart button using 'checkout_cart_configure.xml'
I want to Over write template
\vendor\magento\module-checkout\view\frontend\templates\cart\item\configure\updatecart.phtml
So I have create
app\code\Vendor\Customproduct\view\frontend\layout\checkout_cart_configure.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link src="Magento_Checkout::js/view/configure/product-customer-data.js"/>
</head>
<update handle="catalog_product_view"/>
<body>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="checkout_cart_configure_head_components" template="Magento_Checkout::js/components.phtml"/>
</referenceBlock>
<referenceBlock name="product.info">
<block class="Magento\Checkout\Block\Cart\Item\Configure" name="checkout.cart.item.configure.block"/>
</referenceBlock>
<referenceBlock name="product.info.addtocart">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Customproduct::cart/item/configure/updatecart.phtml</argument>
</action>
</referenceBlock>
<referenceBlock name="product.info.addtocart.additional">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Customproduct::cart/item/configure/updatecart.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
app\code\Vendor\Customproduct\view\frontend\templates\cart\item\configure\updatecart.phtml
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Update Cart'); ?>
<?php if ($_product->isSaleable()): ?>
<div class="box-tocart update">
<fieldset class="fieldset">
<?php if ($block->shouldRenderQuantity()): ?>
<div class="field qty">
<label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label>
<div class="control">
<input type="number"
name="qty"
id="qty"
value=""
title="<?= /* @escapeNotVerified */ __('Qty') ?>"
class="input-text qty"
data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"/>
</div>
</div>
<?php endif; ?>
<div class="actions">
<button type="submit"
title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
class="action primary tocart"
id="product-updatecart-button">
<span><?= /* @escapeNotVerified */ $buttonTitle ?></span>
</button>
<?= $block->getChildHtml('', true) ?>
</div>
</fieldset>
</div>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"validation": {},
"addToCart": {
"cartButtonId": "#product-updatecart-button",
"cartForm": "#product_addtocart_form"
}
}
}
</script>
<script>alert('i am here');</script>
<?php endif; ?>
But There is no changes
So If You have any solution then Please help
Best Answer
For customization on the Update cart button.Please follow this link it is worked great:
How to override the checkout_cart_configure.xml template file into custom module
Thank you.