Skip to content

Configurable option renderer template override is not possible #4400

Closed
@yagneshponkiya

Description

@yagneshponkiya

Steps to reproduce

  1. Have Created custom module to override Magento_ConfigurableProduct::product/view/type/options/configurable.phtml using module.
    2.Llayout code in catalog_product_view_type_configurable.xml

<referenceBlock name="product.info.options.configurable"> <action method="setTemplate"> <argument name='template' xsi:type="string">Namespace_ModuleName::product/view/type/options/configurable.phtml</argument> </action> </referenceBlock>
3 After lot of struggling i was not able to override template file because of below code in

Magento\Swatches\Block\Product\Renderer\Configurable

class Configurable extends \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable
{
    /**
     * Path to template file with Swatch renderer.
     */
    const SWATCH_RENDERER_TEMPLATE = "Magento_Swatches::product/view/renderer.phtml";

    /**
     * Path to default template file with standard Configurable renderer.
     */
    const CONFIGURABLE_RENDERER_TEMPLATE = "Magento_ConfigurableProduct::product/view/type/options/configurable.phtml";
/**
     * @codeCoverageIgnore
     * @return string
     */
    protected function getRendererTemplate()
    {
        return $this->isProductHasSwatchAttribute ?
            self::SWATCH_RENDERER_TEMPLATE : self::CONFIGURABLE_RENDERER_TEMPLATE;
    }

Above constant doesn't allow me to override template how should i do that ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CatalogIssue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions