Is it possible to move apply coupon code button on product page and it will work or not ?
-
I also want to show all available coupon codes of current products in product page– MahendraCommented Apr 2, 2019 at 12:53
-
1So if you want to apply coupon code functionality in the product page, how would you apply the coupon code when the cart is empty?– Raj Mohan RCommented Apr 2, 2019 at 12:54
-
I will set the validation Kindly add product first. OR is there any other solution to pass selected coupon to cart page that is also ok for me.– MahendraCommented Apr 2, 2019 at 12:57
Add a comment
|
1 Answer
Create catalog_product_view.xml
at app/design/frontend/{VendorTheme}/{ThemeName}/Magento_Catalog/layout
and below code:
<?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">
<body>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Cart\Coupon" name="checkout.cart.coupon" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>
</body>
</referenceContainer>
</page>