0

I have implemented Pincode checker in Magento 2 product detail page by creating a custom module, but I need to show it in the header section and hide it from the product detail page. How can I achieve this?

  • Can you please share xml file code? – Dhara Bhatti May 30 at 11:13
  • Currently, I put it under the main menu, but how can put it at the end of the menu near contact us. <referenceContainer name="header.container"> <block class="Vendor\CheckDelivery\Block\Product\View\CheckDelivery" name="zipcode" before="-" template="Vendor_CheckDelivery::product/view/check_delivery.phtml"/> </referenceContainer> – Arul Jun 5 at 7:15
  • Ok, then try the following: <referenceContainer name="footer-container"><block class="Vendor\CheckDelivery\Block\Product\View\CheckDelivery" name="zipcode" after="-" template="Vendor_CheckDelivery::product/view/check_delivery.phtml"/> </referenceContainer> – Dhara Bhatti Jun 5 at 7:25
  • I will try it above code, but it showing at the end of the footer section. But I need to show it in the main menu section. – Arul Jun 5 at 10:35
  • Sorry, my mistake. Please try this one: <referenceContainer name="header-wrapper"> <block class="Vendor\CheckDelivery\Block\Product\View\CheckDelivery" name="zipcode" after="-" template="Vendor_CheckDelivery::product/view/check_delivery.phtml"/> </referenceContainer> – Dhara Bhatti Jun 5 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.