Serving a great shopping experience is a duty of store owner towards their Magento store customers. From landing on a store to check out of the product, the customer passes through the whole shopping funnel. Among which product page plays an important role for the customer to get detailed information about a product before making a purchase. But sometimes it’s not enough or there is information that the store owner is willing to let their customer know before making the purchase.

Recently, one of the clients suffering from the same situation where he was willing to let his customer knows some information before they add the product to their cart. The solution is simple, we have suggested them to add a block after add to cart button, so whenever a customer adds products to cart he or she can make note of it and can ensure that product is a perfect fit for them or not.

Using Block, we can display various information related to the product such as: chart, discount, offers & deals, terms and conditions or caution etc. That’s why today at MageComp blog we came up with an easy solution for adding a block on product page right after the add to cart button.

Steps to Add Block After Add to Cart Button in Magento 2 Product page:

Step 1: Create the “Enquiry.php” file inside the Extension view folder.

app\code\Vendor\Extension\Block\Catalog\Product\View\

Step 2: Now, create the “catalog_product_view.xml” file inside the Extension view folder.

app\code\Vendor\Extension\view\frontend\layout\

Step 3: Now, create the “file.phtml” file inside the Extension view folder.

app\code\Vendor\Extension\view\frontend\templates\catalog\product\view\

Output:

Add Block After Add to Cart Button in Magento 2 Product page

And that’s it! Now clear the cache and you are ready to go.
You can comment down below if you are looking for any help regarding this code.
Happy coding!

Click to rate this post!
[Total: 25 Average: 3.7]