I am creating a custom module to set a custom template for


but I am not able to override it. I have tried using XML like below

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="product.info.options">
        <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" as="default" template="Hemag_StockStatus::product/view/options/type/default.phtml"/>

Please let me know how to do this.


Try following way:


<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="content">
            <referenceBlock name="product.info.options.default" template="SR_MagentoCommunity::product/view/options/type/default.phtml"/>


 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

// @codingStandardsIgnoreFile

<?php $_option = $block->getOption() ?>
<div class="field">
    <label class="label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
  • @Sohal Rana Still not working :( – Mithi Techie May 14 '19 at 10:22
  • Not sure why not working for you, this is working code with M2.3 – Sohel Rana May 14 '19 at 10:54
  • can you please send me your working extension? I am using 2.2.6 version – Mithi Techie May 14 '19 at 11:27
  • I have added this two file and working fine. Did you check with fresh Magento installation or check any other module already overwrite this or not? – Sohel Rana May 14 '19 at 11:34
  • Yes, I have installed it in fresh magento 2.3 and its not working there. – Mithi Techie May 14 '19 at 12:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.