1

I want to create configurable product with dropdown and textbox field attributes. In frontend product detail page, dropdown can be shown but I also want to show textbox. Can anyone please guide me?

2
  • Is that your custom field to enter value from frontend? – Rita Jose Jul 5 '17 at 12:39
  • yes, I want to enter value in frontend – jassi Jul 5 '17 at 12:43
0

In your custom module create an xml file like this,

app/code/Module/Namespace/view/frontend/layout/catalog_product_view.xml

In that xml file, paste the below code

<?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">
    <body>
        <referenceContainer name="content">
            <referenceBlock name="product.info.options">
                <action method="setTemplate">
                    <argument name="template" xsi:type="string">Module_Namespace::product/view/options/type/select.phtml</argument>
                </action>
            </referenceBlock>
         </referenceContainer>
    </body>
</page>

Then create a template file in this path

app/code/Module/Namespace/view/frontend/template/product/view/options/type/select.phtml

Then you can add your custom input text field code in that file.

Eg: First name: <input type="text" name="firstname">

2
  • Dropdown I can make by using configurable product but problem is with input text field. I want to do using configurable product – jassi Jul 5 '17 at 13:00
  • you can also add text field here.. eg: First name: <input type="text" name="firstname"> – Rita Jose Jul 5 '17 at 13:09

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.