Showing results for 
Search instead for 
Did you mean: 

Custom text field for configurable product

Custom text field for configurable product

Hi all,

I am very new in Magento and from last few days I am trying to figure out how to add a Custom text field in the frontend for configurable product. I tried to do that but text-field text area is not showing up in the configurable product list of attributes. I can add drop down only.


I am looking for something that for example a customer want to buy a t-shirt and the text inside the t-shirt will be configurable from frontend product view page. 



For example : custom text cost $5. There will be a checkbox in the product view page. When the customer click on it a text box will appear where he can add his text for the t-shirt. The $5 will automatically add with the checkout price.


I hope I am able to make you understand what I am trying to do. But, search a lot to figure it out but failed.




Re: Custom text field for configurable product



Please mention which version Magento you use?


The below solution is for Magento 1.x


I will mention two files which is use for configure product.


1. app/design/frontend/base/default/template/catalog/product/view/type/options/configurable.phtml


Here is define configure product drop box.


2. app/design/frontend/base/default/template/catalog/product/view.phtml


view.phtml is main view page which is include all type of product, price, image etc...


You have to include your code according to your requirement.


If this post is fulfill your solution then please mark as accept.





Re: Custom text field for configurable product

Hello Man_in_Black,

Check out this example it might help you 

Create a file as Mypackage/Mymodule/Setup/InstallData.php and aa the following code then 

run setup upgrade and re-compile and clear cache.


 * Copyright © 2015 Ipragmatech. All rights reserved.
namespace Mypackage\Mymodule\Setup;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface

     * Customer setup factory
     * @var \Magento\Customer\Setup\CustomerSetupFactory
    private $_eavSetupFactory;

     * Init
     * @param \Magento\Customer\Setup\CustomerSetupFactory
     * $customerSetupFactory
    public function __construct(
        \Magento\Eav\Setup\EavSetupFactory $eavSetupFactory
    ) {
        $this->_eavSetupFactory = $eavSetupFactory;

     * Installs DB schema for a module
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     * @return void
    public function install(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        /** @var EavSetup $eavSetup */
        $eavSetup = $this->_eavSetupFactory->create([
            'setup' => $setup

        /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
            'is_feature', [
                'group'                   => 'Product Details',
                'type'                    => 'int',
                'backend'                 => '',
                'frontend'                => '',
                'label'                   => 'Is Feature',
                'input'                   => 'select',
                'source'                  =>
                'visible'                 => true,
                'default'                 => '0',
                'frontend'                => '',
                'unique'                  => false,
                'note'                    => '',
                'required'                => false,
                'sort_order'              => '',
                'global'                  =>
                'used_in_product_listing' => true,
                'visible_on_front'        => true


Re: Custom text field for configurable product



This can easily be solved using native Magento functionality. No code changes is required as suggested with above posts. 


You can add 'Custom Options' to a product (both configurable and simple). Look for 'Custom Options' or 'Customizable Options' when editing the product. You can then add free text field or area, and also choose to set a fee for it if you like.


Hope that helps - let me know if you want me to add some screenshots. 

Magento Solution Consultant at Inviqa (formerly Session Digital) - Leading Magento Gold Partner
My own blog - Think Commerce

Re: Custom text field for configurable product



This works!!! BUT Smiley Happy Smiley Happy

Can I make this for all products? (of my selected products?) Can I do this in a attributeset??


Thnx for the reply in advance

Re: Custom text field for configurable product

Dear Manish,

This php code reports some errors in lines 47 - 53 and 71 on dreamweaver.


Can you please check and revert? also how do we execute this file?


Please kindly inform if this file allows us to add custom text field as a configurable attribute like drop-down input type in a configurable product.