{"id":306063,"date":"2021-09-19T16:22:56","date_gmt":"2021-09-19T16:22:56","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=306063"},"modified":"2024-07-26T10:29:20","modified_gmt":"2024-07-26T10:29:20","slug":"create-dependent-attribute-fields-on-customer-registration-form","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/","title":{"rendered":"Create Dependent Attribute Fields on Customer Registration Form"},"content":{"rendered":"\n<p>Hello Friends!<br>In this blog, we are going to learn how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.<\/p>\n\n\n\n<p>In Magento 2, sometimes we need to get some additional information from customers.<br>For example, if we want to know from where customers got this reference of our store, then we can add custom fields on customer registration to get that information.<\/p>\n\n\n\n<p>We can add multiple options so that customers can choose. But, after all the options, if we want to provide an option to add another option from his end. Then, in that case, there will be a need to add the dependent field in the form.<\/p>\n\n\n\n<p>Here, I have created a boolean option to choose whether the customer wants to add his aadhaar number or not. If he will choose &#8220;Yes&#8221;, then the &#8220;Aadhaar Number&#8221; field will be displayed and he can fill in his aadhaar number.<\/p>\n\n\n\n<p>To achieve &#8220;<span style=\"text-decoration: underline\">custom dependent attributes on customer registration form<\/span>&#8221; functionality, please go through the following steps:<\/p>\n\n\n\n<p><strong>1.<\/strong> First of all, create custom customer attributes in the database. So, create MyCustomerAttributes.php file inside the &lt;magento-root-dir>\/app\/code\/Vendor\/CustomModule\/Setup\/Patch\/Data\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n* Copyright \u00a9 Vendor, Inc. All rights reserved.\n* See COPYING.txt for license details.\n*\/\n\nnamespace Vendor\\CustomModule\\Setup\\Patch\\Data;\n\nuse Magento\\Customer\\Model\\Customer;\nuse Magento\\Eav\\Model\\Config;\nuse Magento\\Eav\\Setup\\EavSetupFactory;\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\nuse Magento\\Framework\\Setup\\Patch\\DataPatchInterface;\nuse Magento\\Framework\\Setup\\Patch\\PatchRevertableInterface;\nuse Psr\\Log\\LoggerInterface;\n\n\/**\n* Class MyCustomerAttributes\n* @package Vendor\\CustomModule\\Setup\\Patch\\Data\n*\/\nclass MyCustomerAttributes implements DataPatchInterface, PatchRevertableInterface\n{\n   \/**\n    * @var ModuleDataSetupInterface\n    *\/\n   private $moduleDataSetup;\n\n   \/**\n    * @var EavSetupFactory\n    *\/\n   private $eavSetupFactory;\n  \n   \/**\n    * @var LoggerInterface\n    *\/\n   private $logger;\n\n   \/**\n    * @var Config\n    *\/\n   private $eavConfig;\n\n   \/**\n    * @var \\Magento\\Customer\\Model\\ResourceModel\\Attribute\n    *\/\n   private $attributeResource;\n\n   \/**\n    * constructor.\n    * @param EavSetupFactory $eavSetupFactory\n    * @param Config $eavConfig\n    * @param LoggerInterface $logger\n    * @param \\Magento\\Customer\\Model\\ResourceModel\\Attribute $attributeResource\n    *\/\n   public function __construct(\n       EavSetupFactory $eavSetupFactory,\n       Config $eavConfig,\n       LoggerInterface $logger,\n       \\Magento\\Customer\\Model\\ResourceModel\\Attribute $attributeResource,\n       \\Magento\\Framework\\Setup\\ModuleDataSetupInterface $moduleDataSetup\n   ) {\n       $this-&gt;eavSetupFactory = $eavSetupFactory;\n       $this-&gt;eavConfig = $eavConfig;\n       $this-&gt;logger = $logger;\n       $this-&gt;attributeResource = $attributeResource;\n       $this-&gt;moduleDataSetup = $moduleDataSetup;\n   }\n\n   \/**\n    * {@inheritdoc}\n    *\/\n   public function apply()\n   {\n       $this-&gt;moduleDataSetup-&gt;getConnection()-&gt;startSetup();\n       $this-&gt;addPhoneAttribute();\n       $this-&gt;moduleDataSetup-&gt;getConnection()-&gt;endSetup();\n   }\n\n   \/**\n    * @throws \\Magento\\Framework\\Exception\\AlreadyExistsException\n    * @throws \\Magento\\Framework\\Exception\\LocalizedException\n    * @throws \\Zend_Validate_Exception\n    *\/\n   public function addPhoneAttribute()\n   {\n       $eavSetup = $this-&gt;eavSetupFactory-&gt;create();\n\n       $eavSetup-&gt;addAttribute(\n           \\Magento\\Customer\\Model\\Customer::ENTITY,\n           &#039;wk_custom_aadhaar_number&#039;,\n           &#091;\n               &#039;type&#039; =&gt; &#039;varchar&#039;,\n               &#039;label&#039; =&gt; &#039;Aadhaar Number&#039;,\n               &#039;input&#039; =&gt; &#039;text&#039;,\n               &#039;source&#039; =&gt; &#039;&#039;,\n               &#039;required&#039; =&gt; false,\n               &#039;visible&#039; =&gt; true,\n               &#039;user_defined&#039; =&gt; 1,\n               &#039;sort_order&#039; =&gt; 999,\n               &#039;position&#039; =&gt; 999,\n               &#039;system&#039; =&gt; false,\n               &#039;backend&#039; =&gt; &#039;&#039;\n           ]\n       );\n\n       $attributeSetId = $eavSetup-&gt;getDefaultAttributeSetId(Customer::ENTITY);\n       $attributeGroupId = $eavSetup-&gt;getDefaultAttributeGroupId(Customer::ENTITY);\n\n       $attribute = $this-&gt;eavConfig-&gt;getAttribute(Customer::ENTITY, &#039;wk_custom_aadhaar_number&#039;);\n       $attribute-&gt;setData(&#039;attribute_set_id&#039;, $attributeSetId);\n       $attribute-&gt;setData(&#039;attribute_group_id&#039;, $attributeGroupId);\n\n       $attribute-&gt;setData(&#039;used_in_forms&#039;, &#091;\n           &#039;customer_account_create&#039;,\n           &#039;adminhtml_customer&#039;,\n           &#039;customer_account_edit&#039;,\n           &#039;customer_attributes_registration&#039;\n       ]);\n\n       $this-&gt;attributeResource-&gt;save($attribute);\n\n\n       $eavSetup-&gt;addAttribute(\n           \\Magento\\Customer\\Model\\Customer::ENTITY,\n            &#039;wk_custom_want_to_add_aadhaar&#039;,\n            &#091;\n                &#039;type&#039; =&gt; &#039;int&#039;,\n                &#039;label&#039; =&gt; &#039;Do you want add your aadhaar number?&#039;,\n                &#039;input&#039; =&gt; &#039;boolean&#039;,\n                &#039;source&#039; =&gt; &#039;&#039;,\n                &#039;required&#039; =&gt; false,\n                &#039;visible&#039; =&gt; true,\n                &#039;position&#039; =&gt; 333,\n                &#039;system&#039; =&gt; false,\n                &#039;backend&#039; =&gt; &#039;&#039;\n            ]\n        );\n       $attribute = $this-&gt;eavConfig-&gt;getAttribute(Customer::ENTITY, &#039;wk_custom_want_to_add_aadhaar&#039;);\n       $attribute-&gt;setData(&#039;attribute_set_id&#039;, $attributeSetId);\n       $attribute-&gt;setData(&#039;attribute_group_id&#039;, $attributeGroupId);\n\n       $attribute-&gt;setData(&#039;used_in_forms&#039;, &#091;\n           &#039;customer_account_create&#039;,\n           &#039;adminhtml_customer&#039;,\n           &#039;customer_account_edit&#039;,\n           &#039;customer_attributes_registration&#039;\n       ]);\n\n       $this-&gt;attributeResource-&gt;save($attribute);\n   }\n\n   \/**\n    * {@inheritdoc}\n    *\/\n   public static function getDependencies()\n   {\n       return &#091;];\n   }\n\n   \/**\n    *\n    *\/\n   public function revert()\n   {\n   }\n\n   \/**\n    * {@inheritdoc}\n    *\/\n   public function getAliases()\n   {\n       return &#091;];\n   }\n}<\/pre>\n\n\n\n<p><strong>2. <\/strong>Create Element.php file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/Block\/Widget\/Form\/Renderer\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * @author Vendor\n * @copyright Copyright (c) 2021 Vendor\n * @package Vendor_CustomModule\n *\/\n\n\nnamespace Vendor\\CustomModule\\Block\\Widget\\Form\\Renderer;\n\nuse Magento\\Framework\\Data\\Form\\Element\\AbstractElement;\n\n\/**\n * @SuppressWarnings(PHPMD.DepthOfInheritance)\n *\/\nclass Element extends \\Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset\\Element\n{\n    \/**\n     * Initialize block template\n     *\/\n    protected $_template = &#039;Vendor_CustomModule::widget\/form\/renderer\/fieldset\/element.phtml&#039;;\n    \/**\n     * @var Validation\n     *\/\n    private $validation;\n\n    \/**\n     * Element constructor.\n     * @param \\Magento\\Backend\\Block\\Template\\Context $context\n     *\/\n    public function __construct(\n        \\Magento\\Backend\\Block\\Template\\Context $context,\n        array $data = &#091;]\n    ) {\n        parent::__construct($context, $data);\n    }\n\n    \/**\n     * @param AbstractElement $element\n     * @return string\n     *\/\n    public function render(AbstractElement $element)\n    {\n        $html = parent::render($element);\n        return $html;\n    }\n}<\/pre>\n\n\n\n<p><strong>3. <\/strong>Create Fieldset.php file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/Block\/Widget\/Form\/Renderer\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * @author Vendor\n * @copyright Copyright (c) 2021 Vendor\n * @package Vendor_CustomModule\n *\/\n\nnamespace Vendor\\CustomModule\\Block\\Widget\\Form\\Renderer;\n\n\nclass Fieldset extends \\Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset\n{\n    protected $_template = &#039;Vendor_CustomModule::widget\/form\/renderer\/fieldset.phtml&#039;;\n\n    public function getRelationJson()\n    {\n        $depends = $this-&gt;getElement()-&gt;getData(&#039;depends&#039;);\n        if (!$depends) {\n            return &#039;&#039;;\n        }\n        foreach ($depends as &amp;$relation) {\n            $relation&#091;&#039;parent_attribute_element_uid&#039;] = $this-&gt;getJsId(\n                &#039;form-field&#039;,\n                $relation&#091;&#039;parent_attribute_code&#039;]\n            );\n            $relation&#091;&#039;depend_attribute_element_uid&#039;] = $this-&gt;getJsId(\n                &#039;form-field&#039;,\n                $relation&#091;&#039;depend_attribute_code&#039;]\n            );\n        }\n        $this-&gt;getElement()-&gt;setData(&#039;depends&#039;, $depends);\n\n        return $this-&gt;getElement()-&gt;convertToJson(&#091;&#039;depends&#039;]);\n    }\n}<\/pre>\n\n\n\n<p><strong>4.<\/strong> Create Boolean.php file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/Block\/Data\/Form\/Element\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * @author Vendor\n * @copyright Copyright (c) 2021 Vendor\n * @package Vendor_CustomModule\n *\/\n\nnamespace Vendor\\CustomModule\\Block\\Data\\Form\\Element;\n\nclass Boolean extends \\Magento\\Catalog\\Block\\Adminhtml\\Product\\Helper\\Form\\Boolean\n{\n    \/**\n     * @return void\n     *\/\n    protected function _construct()\n    {\n        parent::_construct();\n        $values = $this-&gt;getValues();\n        if (!$this-&gt;getRequired()) {\n            array_unshift($values, &#091;&#039;label&#039; =&gt; &#039; &#039;, &#039;value&#039; =&gt; &#039;&#039;]);\n        }\n        $this-&gt;setValues($values);\n    }\n}<\/pre>\n\n\n\n<p><strong>5.<\/strong> Create element.phtml file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/view\/frontend\/templates\/widget\/form\/renderer\/fieldset\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * @author Vendor\n * @copyright Copyright (c) 2021 Vendor\n * @package Vendor_CustomModule\n *\/\n?&gt;\n\n&lt;?php\n\/* @var $block \\Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset\\Element *\/\n$element = $block-&gt;getElement();\n$note = $element-&gt;getNote() ? &#039;&lt;div class=&quot;note&quot; id=&quot;&#039; . $element-&gt;getId() . &#039;-note&quot;&gt;&#039; . $element-&gt;getNote() . &#039;&lt;\/div&gt;&#039; : &#039;&#039;;\n$elementBeforeLabel = $element-&gt;getExtType() == &#039;checkbox admin__control-checkbox&#039; || $element-&gt;getExtType() == &#039;radio admin__control-radio&#039;;\n$addOn = ($element-&gt;getBeforeElementHtml() || $element-&gt;getAfterElementHtml()) &amp;&amp; !$element-&gt;getNoWrapAsAddon();\n$fieldId = ($element-&gt;getHtmlContainerId()) ? &#039; id=&quot;&#039; . $element-&gt;getHtmlContainerId() . &#039;&quot;&#039; : &#039;&#039;;\n$fieldClass = &quot;admin__field field field-{$element-&gt;getId()} {$element-&gt;getCssClass()}&quot;;\n$fieldClass .= ($elementBeforeLabel) ? &#039; choice&#039; : &#039;&#039;;\n$fieldClass .= ($addOn) ? &#039; with-addon&#039; : &#039;&#039;;\n$fieldClass .= ($element-&gt;getRequired()) ? &#039; required _required&#039; : &#039;&#039;;\n$fieldClass .= ($note) ? &#039; with-note&#039; : &#039;&#039;;\n$fieldClass .= (!$element-&gt;getLabelHtml()) ? &#039; no-label&#039; : &#039;&#039;;\n\n$fieldAttributes = $fieldId . &#039; class=&quot;&#039; . $fieldClass . &#039;&quot; &#039;\n    . $block-&gt;getUiId(&#039;form-field&#039;, $element-&gt;getId())\n    . ($element-&gt;getFieldExtraAttributes() ? &#039; &#039; . $element-&gt;getFieldExtraAttributes() : &#039;&#039;);\n?&gt;\n\n&lt;?php if (!$element-&gt;getNoDisplay()): ?&gt;\n    &lt;?php if ($element-&gt;getType() == &#039;hidden&#039;): ?&gt;\n        &lt;?php echo $element-&gt;getElementHtml() ?&gt;\n    &lt;?php else: ?&gt;\n    &lt;div&lt;?php \/* @escapeNotVerified *\/ echo $fieldAttributes ?&gt;&gt;\n        &lt;?php if ($elementBeforeLabel): ?&gt;\n            &lt;?php echo $element-&gt;getElementHtml() ?&gt;\n            &lt;?php echo $element-&gt;getLabelHtml() ?&gt;\n            &lt;?php \/* @escapeNotVerified *\/ echo $note ?&gt;\n        &lt;?php else: ?&gt;\n            &lt;?php echo $element-&gt;getLabelHtml() ?&gt;\n            &lt;div class=&quot;admin__field-control control&quot;&gt;\n                &lt;?php \/* @escapeNotVerified *\/ echo($addOn) ? &#039;&lt;div class=&quot;admin__field&quot;&gt;&#039; . $element-&gt;getElementHtml() . &#039;&lt;\/div&gt;&#039; : $element-&gt;getElementHtml(); ?&gt;\n                &lt;?php \/* @escapeNotVerified *\/ echo $note ?&gt;\n            &lt;\/div&gt;\n        &lt;?php endif; ?&gt;\n        &lt;?php if ($element-&gt;getScopeLabel()): ?&gt;\n            &lt;div class=&quot;field-service&quot; value-scope=&quot;&lt;?php \/* @escapeNotVerified *\/ echo $element-&gt;getScopeLabel()?&gt;&quot;&gt;\n            &lt;\/div&gt;\n        &lt;?php endif;?&gt;\n    &lt;\/div&gt;\n    &lt;?php endif; ?&gt;\n&lt;?php endif; ?&gt;<\/pre>\n\n\n\n<p><strong>6.<\/strong> Create fieldset.phtml file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/view\/frontend\/templates\/widget\/form\/renderer\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * @author Vendor\n * @copyright Copyright (c) 2021 Vendor\n * @package Vendor_CustomModule\n *\/\n?&gt;\n&lt;?php\n    \/** @var $block \\Vendor\\CustomModule\\Block\\Widget\\Form\\Renderer\\Fieldset *\/\n    \/** @var $element \\Magento\\Framework\\Data\\Form\\Element\\Fieldset *\/\n    $element = $block-&gt;getElement();\n    $containerId = $element-&gt;getFieldsetContainerId();\n    $id = $element-&gt;getHtmlId();\n    $isCollapsable = $element-&gt;getCollapsable();\n    $isWrapped = $containerId || $element-&gt;getHeaderBar() || $isCollapsable;\n    $titleActions = &#039;&lt;div class=&quot;actions&quot;&gt;&#039; . $element-&gt;getHeaderBar() . &#039;&lt;\/div&gt;&#039;;\n    $isField = $element-&gt;getFieldsetType() == &#039;field&#039;;\n    $advancedAfter = $element-&gt;getAdvancedPosition() == &#039;after&#039;; \/\/ To place advanced options inside or after fieldset\n    $advancedLabel = $element-&gt;getAdvancedLabel();\n    if (!isset($advancedLabel)) {\n        $advancedLabel = __(&#039;Additional Settings&#039;);\n    }\n\n    $cssClass = ($isField) ? &#039;field &#039; . $element-&gt;getClass() : &#039;fieldset admin__fieldset &#039; . $element-&gt;getClass();\n\n    if ($isField) {\n        $count = $element-&gt;getCountBasicChildren();\n        $cssClass .= ($element-&gt;hasAdvanced()) ? &#039; complex&#039; : &#039;&#039;;\n    }\n?&gt;\n\n&lt;?php\n\/**\n * @todo investigate situations, when the following is needed:\n * echo $element-&gt;getHeaderBar();\n * echo $element-&gt;getSubFieldsetHtml();\n *\/ ?&gt;\n\n&lt;?php if ($isWrapped): ?&gt;\n&lt;div class=&quot;fieldset-wrapper &lt;?php echo ($isCollapsable) ? &#039;admin__collapsible-block-wrapper &#039; : &#039;&#039;; ?&gt;&quot;\n     id=&quot;&lt;?php \/* @escapeNotVerified *\/\n     echo $containerId ? $containerId : $id . &#039;-wrapper&#039;; ?&gt;&quot;\n     data-role=&quot;&lt;?php \/* @escapeNotVerified *\/\n     echo $id ?&gt;-wrapper&quot;&gt;\n    &lt;div class=&quot;fieldset-wrapper-title admin__fieldset-wrapper-title&quot;&gt;\n        &lt;strong &lt;?php \/* @escapeNotVerified *\/\n        echo ($isCollapsable) ?\n            &#039;class=&quot;admin__collapsible-title&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#&#039; . $id . &#039;-content&quot;&#039; :\n            &#039;class=&quot;title&quot;&#039;; ?&gt;&gt;\n            &lt;span&gt;&lt;?php \/* @escapeNotVerified *\/\n                echo $element-&gt;getLegend() ?&gt;&lt;\/span&gt;\n        &lt;\/strong&gt;\n        &lt;?php \/* @escapeNotVerified *\/\n        echo $titleActions; ?&gt;\n    &lt;\/div&gt;\n    &lt;div class=&quot;fieldset-wrapper-content admin__fieldset-wrapper-content&lt;?php echo ($isCollapsable) ? &#039; collapse&#039; : &#039;&#039;; ?&gt;&quot;\n         id=&quot;&lt;?php \/* @escapeNotVerified *\/\n         echo $id ?&gt;-content&quot;\n         data-role=&quot;&lt;?php \/* @escapeNotVerified *\/\n         echo $id ?&gt;-content&quot;&gt;\n        &lt;?php endif; ?&gt;\n\n        &lt;?php if (!$element-&gt;getNoContainer()): ?&gt;\n        &lt;fieldset style=&quot;display: none;&quot; class=&quot;&lt;?php \/* @escapeNotVerified *\/\n        echo $cssClass ?&gt;&quot; id=&quot;&lt;?php \/* @escapeNotVerified *\/\n        echo $id ?&gt;&quot;&gt;\n            &lt;?php if ($element-&gt;getLegend() &amp;&amp; !$isWrapped): ?&gt;\n                &lt;div class=&quot;&lt;?php \/* @escapeNotVerified *\/\n                echo $isField ? &#039;label admin__field-label&#039; : &#039;admin__legend&#039; ?&gt; step-title&quot;&gt;\n                    &lt;span&gt;&lt;?php \/* @escapeNotVerified *\/\n                        echo $element-&gt;getLegend() ?&gt;&lt;\/span&gt;\n                &lt;\/div&gt;\n            &lt;?php endif; ?&gt;\n            &lt;?php endif; ?&gt;\n\n            &lt;div class=&quot;messages&quot;&gt;\n                &lt;?php if ($element-&gt;getComment() &amp;&amp; !$isField): ?&gt;\n                    &lt;div class=&quot;message message-notice&quot;&gt;&lt;?php echo $block-&gt;escapeHtml($element-&gt;getComment()) ?&gt;&lt;\/div&gt;\n                &lt;?php endif; ?&gt;\n            &lt;\/div&gt;\n\n            &lt;?php echo ($isField) ? &#039;&lt;div class=&quot;control admin__field-control&quot;&gt;&#039; : &#039;&#039;; ?&gt;\n\n            &lt;?php if ($element-&gt;hasHtmlContent() &amp;&amp; !$isField): ?&gt;\n                &lt;?php echo $element-&gt;getHtmlContent(); ?&gt;\n            &lt;?php else: ?&gt;\n\n            &lt;?php if ($isField &amp;&amp; $count &gt; 1): ?&gt;\n            &lt;div class=&quot;fields-group-&lt;?php \/* @escapeNotVerified *\/\n            echo $count ?&gt;&quot;&gt;\n                &lt;?php endif; ?&gt;\n\n                &lt;?php echo $element-&gt;getBasicChildrenHtml(); ?&gt;\n\n                &lt;?php echo ($isField &amp;&amp; $count &gt; 1) ? &#039;&lt;\/div&gt;&#039; : &#039;&#039; ?&gt;\n\n                &lt;?php if ($element-&gt;getComment() &amp;&amp; $isField): ?&gt;\n                    &lt;div class=&quot;note&quot;&gt;&lt;?php echo $block-&gt;escapeHtml($element-&gt;getComment()) ?&gt;&lt;\/div&gt;\n                &lt;?php endif; ?&gt;\n\n                &lt;?php if ($element-&gt;hasAdvanced() &amp;&amp; !$isField): ?&gt;\n                    &lt;?php echo (!$element-&gt;getNoContainer() &amp;&amp; $advancedAfter) ? &#039;&lt;\/fieldset&gt;&#039; : &#039;&#039; ?&gt;\n                    &lt;details data-mage-init=&#039;{&quot;details&quot;: {}}&#039; class=&quot;details admin__collapsible-block-wrapper&quot;\n                             id=&quot;details&lt;?php \/* @escapeNotVerified *\/\n                             echo $id ?&gt;&quot;&gt;\n                        &lt;summary class=&quot;details-summary admin__collapsible-title&quot;\n                                 id=&quot;details-summary&lt;?php \/* @escapeNotVerified *\/\n                                 echo $id ?&gt;&quot;&gt;\n                            &lt;span&gt;&lt;?php \/* @escapeNotVerified *\/\n                                echo $advancedLabel ?&gt;&lt;\/span&gt;\n                        &lt;\/summary&gt;\n                        &lt;div class=&quot;details-content admin__fieldset&quot; id=&quot;details-content&lt;?php \/* @escapeNotVerified *\/\n                        echo $id ?&gt;&quot;&gt;\n                            &lt;?php echo $element-&gt;getAdvancedChildrenHtml(); ?&gt;\n                        &lt;\/div&gt;\n                    &lt;\/details&gt;\n                &lt;?php elseif ($element-&gt;hasAdvanced() &amp;&amp; $isField): ?&gt;\n                    &lt;div class=&quot;nested&quot; id=&quot;nested&lt;?php \/* @escapeNotVerified *\/\n                    echo $id ?&gt;&quot;&gt;\n                        &lt;?php echo $element-&gt;getAdvancedChildrenHtml(); ?&gt;\n                    &lt;\/div&gt;\n                &lt;?php endif; ?&gt;\n\n                &lt;?php echo ($isField) ? &#039;&lt;\/div&gt;&#039; : &#039;&#039;; ?&gt;\n\n                &lt;?php endif; ?&gt;\n\n\n                &lt;?php if (!$element-&gt;getNoContainer() &amp;&amp; !$advancedAfter): ?&gt;\n        &lt;\/fieldset&gt;\n    &lt;?php endif; ?&gt;\n\n        &lt;?php if ($isWrapped): ?&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;?php endif; ?&gt;\n&lt;script&gt;\n    require(&#091;\n        &#039;jquery&#039;,\n        &quot;mage\/calendar&quot;,\n        &quot;Vendor_CustomModule\/js\/view\/relation&quot;\n    ], function ($, calendar, relation) {\n        var currentBeforeSelector,\n            beforeBlockSelectors;\n\n        currentBeforeSelector = &quot;form#form-validate .actions-toolbar&quot;;\n\n        beforeBlockSelectors = &#091;\n            &#039;form#form-validate &gt; fieldset.create.account &gt; .field.gdpr&#039;,\n            &#039;form#form-validate &gt; fieldset.create.account &gt; .field.captcha&#039;,\n            &#039;form#form-validate &gt; fieldset.create.account &gt; .actions-toolbar&#039;\n        ];\n\n        $.each(beforeBlockSelectors, function (index, value) {\n            if ($(value).length &gt; 0) {\n                currentBeforeSelector = value;\n                return false;\n            }\n        });\n\n        if ($(currentBeforeSelector).length) {\n            if ($(currentBeforeSelector).before($(&#039;#group-fields-customer-attributes&#039;).show())) {\n                &lt;?php if ($block-&gt;getRelationJson()) : ?&gt;\n                \/\/ execute relations after block is pasted\n                relation.init(&lt;?php echo $block-&gt;getRelationJson() ?&gt;);\n                &lt;?php endif; ?&gt;\n            }\n        }\n    });\n&lt;\/script&gt;<\/pre>\n\n\n\n<p><strong>7.<\/strong> Create relation.js file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/view\/frontend\/web\/js\/view\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">define(&#091;\n    &#039;jquery&#039;\n], function($) {\n        &#039;use strict&#039;;\n        return {\n            config : {},\n            indexedElements : &#091;],\n            \/**\n             * @param {Object&#091;]} options\n             * @returns {jquery}\n             *\/\n            init: function (options) {\n                this.config = options.depends;\n                this.initInputElements();\n                return this;\n            },\n            \/\/ init parent element listeners\n            initInputElements: function() {\n                var different = &#091;];\n                $.each(this.config, function(key, parentrelation) {\n                    var element = this.getElement(parentrelation.parent_attribute_element_uid);\n                    if (element != void(0) &amp;&amp; element.length &amp;&amp; $.inArray(element.selector, different) == -1) {\n                        different.push(element.selector);\n                        element.on(&#039;change&#039;, function (event) {\n                            this.observer(event);\n                            this.indexedElements = &#091;];\n                        }.bind(this));\n                        \/\/ for custom check\n                        element.on(&#039;check_relations&#039;, this.observer.bind(this));\n                        element.find(&#039;select&#039;).each(function (key, input) {\n                            $(input).trigger(&quot;check_relations&quot;);\n                        });\n                        this.indexedElements = &#091;];\n                    }\n                }.bind(this));\n            },\n            getElement: function (id) {\n                return $(&#039;&#091;data-ui-id=&quot;&#039; + id + &#039;&quot;]&#039;);\n            },\n            observer: function (event) {\n                var element = $(event.target);\n                var block = $(event.currentTarget);\n                if (element &amp;&amp; block) {\n                    var elementId = block.attr(&#039;data-ui-id&#039;);\n                    this.checkDependencies(element, elementId);\n                }\n            },\n            checkDependencies: function (element, elementId) {\n                \/\/ Find dependents elements\n                var elementDependencies = this.findElementDependencies(elementId);\n                \/\/ Iterate throw elements and show required elements\n                $.each(elementDependencies, function(key, relation) {\n                    if (this.getElement(relation.depend_id).length) {\n                            \/\/ Multiselect and select\n                        if (this.canShow(relation)) {\n                            this.showBlock(relation.depend_id);\n                        } else if (this.indexedElements.indexOf(relation.depend_id) &lt; 0) {\n                            this.hideBlock(relation.depend_id);\n                        }\n\n                    }\n                }.bind(this));\n            },\n            canShow: function (relationToShow) {\n                var parentRelations = this.findElementParentDependencies(relationToShow);\n                var result = true;\n\n                \/\/ check all parent elements\n                $.each(parentRelations, function(key, relation) {\n                    var block = this.getElement(relation.parent_id);\n                    if (result &amp;&amp; block.length) {\n                        result = !!(this.checkSelect(block.find(&#039;select&#039;), relation));\n                    }\n                }.bind(this));\n\n                return result;\n            },\n           \n            \/*\n             * check for select, multiselect\n             *\/\n            checkSelect: function (element, relation) {\n                if (!element.length) {\n                    return false;\n                }\n                return element.val() != void(0) &amp;&amp; element.val().indexOf(relation.value) != -1 &amp;&amp; element.is(&quot;:visible&quot;)\n            },\n\n            hideBlock: function (id) {\n                var element = this.getElement(id);\n                element.hide();\n                element.find(&#039;select&#039;).each(function (key, input) {\n                    $(input).trigger(&quot;check_relations&quot;);\n                });\n            },\n            showBlock: function (id) {\n                var element = this.getElement(id);\n                element.show();\n                this.indexedElements.push(id);\n                element.find(&#039;select&#039;).each(function (key, input) {\n                    $(input).trigger(&quot;check_relations&quot;);\n                });\n            },\n            findElementDependencies: function (elementUId) {\n                var elements = &#091;];\n                $.each(this.config, function(key, item) {\n                    if (item.parent_attribute_element_uid == elementUId) {\n                        var el = {\n                            &#039;depend_id&#039;: item.depend_attribute_element_uid,\n                            &#039;value&#039;: item.parent_option_id\n                        };\n                        elements.push(el);\n                    }\n                });\n                return elements;\n            },\n            findElementParentDependencies: function (elementId) {\n                var elements = &#091;];\n                $.each(this.config, function(key, item) {\n                    if (item.depend_attribute_element_uid == elementId.depend_id\n                        &amp;&amp; item.parent_option_id == elementId.value\n                    ) {\n                        var el = {\n                            &#039;parent_id&#039;: item.parent_attribute_element_uid,\n                            &#039;depend_id&#039;: item.depend_attribute_element_uid,\n                            &#039;value&#039;: item.parent_option_id\n                        };\n                        elements.push(el);\n                    }\n                });\n                return elements;\n            }\n        }\n    }\n);<\/pre>\n\n\n\n<p><strong>8.<\/strong> Create customer_account_create.xml file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/view\/frontend\/layout\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;!--\n\/**\n * @author Vendor\n * @copyright Copyright (c) 2021 Vendor\n * @package Vendor_CustomModule\n *\/\n--&gt;\n&lt;page xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&quot;&gt;\n    &lt;body&gt;\n        &lt;referenceContainer name=&quot;form.additional.info&quot;&gt;\n            &lt;block class=&quot;Vendor\\CustomModule\\Block\\Customer\\Form\\CustomerAttributes&quot; name=&quot;attributes_customer_register&quot; template=&quot;customer_attributes.phtml&quot; cacheable=&quot;false&quot;\/&gt;\n        &lt;\/referenceContainer&gt;\n    &lt;\/body&gt;\n&lt;\/page&gt;<\/pre>\n\n\n\n<p><strong>9. <\/strong>Create customer_attributes.phtml file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/view\/frontend\/templates\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_CustomModule\n * @author    Webkul\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n$customerData = $block-&gt;getCustomerData();\n$aadharNumber = $customerData&#091;&quot;wk_custom_aadhaar_number&quot;] ?? &quot;&quot;;\n$isAadhar = $customerData&#091;&quot;wk_custom_want_to_add_aadhaar&quot;] ?? 0;\n?&gt;\n&lt;legend class=&quot;legend&quot;&gt;&lt;span&gt;Additional Information&lt;\/span&gt;&lt;\/legend&gt;\n&lt;div class=&quot;field&quot;&gt;\n    &lt;label for=&quot;wk_custom_want_to_add_aadhaar&quot; class=&quot;label&quot;&gt;\n    &lt;span&gt;&lt;?= $block-&gt;escapeHtml(__(&#039;Do you want add your aadhar number?&#039;)) ?&gt;&lt;\/span&gt;&lt;\/label&gt;\n    &lt;div class=&quot;control&quot;&gt;\n        &lt;select name=&quot;wk_custom_want_to_add_aadhaar&quot; id=&quot;wk_custom_want_to_add_aadhaar&quot; class=&quot;select&quot;&gt;\n            &lt;option value=&quot;1&quot; &lt;?= \/* @noEscape*\/ ($isAadhar==1)?&#039;selected&#039;:&#039;&#039;;?&gt; &gt;&lt;?= $block-&gt;escapeHtml(__(&#039;Yes&#039;)) ?&gt;&lt;\/option&gt;\n            &lt;option value=&quot;0&quot; &lt;?= \/*noEscape *\/ ($isAadhar==0)?&#039;selected&#039;:&#039;&#039;;?&gt;&gt;&lt;?= $block-&gt;escapeHtml(__(&#039;No&#039;)) ?&gt;&lt;\/option&gt;\n        &lt;\/select&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;div class=&quot;field&quot;&gt;\n    &lt;label class=&quot;label&quot; for=&quot;Aadhaar Number&quot;&gt;\n        &lt;span&gt;&lt;?= \/** @noEscape *\/ __(&#039;Aadhaar Number&#039;);?&gt;&lt;\/span&gt;\n    &lt;\/label&gt;\n    &lt;div class=&quot;control&quot;&gt;\n        &lt;input type=&quot;text&quot; name=&quot;wk_custom_aadhaar_number&quot; id=&quot;wk_custom_aadhaar_number&quot; \n               title=&quot;&lt;?= \/** @noEscape *\/ __(&#039;Aadhaar Number&#039;);?&gt;&quot; class=&quot;input-text&quot;\n               maxlength=&quot;12&quot;\n        value=&quot;&lt;?= \/* @noEscape *\/ $aadharNumber ?&gt;&quot;&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\n\n\n<p><strong>10.<\/strong> Create CustomerAttributes.php file inside the &lt;magento-root-dir&gt;\/app\/code\/Vendor\/CustomModule\/Block\/Customer\/Form\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace Vendor\\CustomModule\\Block\\Customer\\Form;\n\nuse Magento\\Backend\\Block\\Template\\Context;\nuse Magento\\Framework\\Registry;\nuse Magento\\Framework\\Data\\FormFactory;\nuse Vendor\\CustomModule\\Block\\Widget\\Form\\Renderer\\Element;\nuse Vendor\\CustomModule\\Block\\Widget\\Form\\Renderer\\Fieldset;\nuse Magento\\Eav\\Model\\Entity\\Attribute;\nuse Magento\\Customer\\Model\\AttributeMetadataDataProvider;\nuse Magento\\Framework\\ObjectManagerInterface;\nuse Magento\\Store\\Model\\StoreManagerInterface;\nuse Magento\\Catalog\\Block\\Adminhtml\\Form;\nuse Magento\\Customer\\Model\\Session;\nuse Magento\\Framework\\DataObjectFactory;\n\nclass CustomerAttributes extends Form\n{\n    \/**\n     * @var StoreManagerInterface\n     *\/\n    private $storeManager;\n\n    \/**\n     * @var Session\n     *\/\n    private $session;\n\n    \/**\n     * @var DataObjectFactory\n     *\/\n    private $dataObjectFactory;\n\n    \/**\n     * @var Element\n     *\/\n    private $elementRenderer;\n\n    \/**\n     * @var AttributeMetadataDataProvider\n     *\/\n    private $attributeMetadataDataProvider;\n\n    \/**\n     * @var ObjectManagerInterface\n     *\/\n    private $objectManager;\n\n    \/**\n     * @var  array\n     *\/\n    private $_customerData;\n\n    \/**\n     * @var Fieldset\n     *\/\n    private $fieldsetRenderer;\n\n    \/**\n     * Attributes constructor.\n     *\n     * @param Context $context\n     * @param Registry $registry\n     * @param Session $session\n     * @param FormFactory $formFactory\n     * @param Fieldset $fieldsetRenderer\n     * @param Element $elementRenderer\n     * @param ObjectManagerInterface $objectManager\n     * @param DataObjectFactory $dataObjectFactory\n     * @param AttributeMetadataDataProvider $attributeMetadataDataProvider\n     * @param array $data\n     *\/\n    public function __construct(\n        Context $context,\n        Registry $registry,\n        Session $session,\n        FormFactory $formFactory,\n        Fieldset $fieldsetRenderer,\n        Element $elementRenderer,\n        ObjectManagerInterface $objectManager,\n        DataObjectFactory $dataObjectFactory,\n        AttributeMetadataDataProvider $attributeMetadataDataProvider,\n        array $data = &#091;]\n    ) {\n        parent::__construct($context, $registry, $formFactory, $data);\n        $this-&gt;session           = $session;\n        $this-&gt;fieldsetRenderer  = $fieldsetRenderer;\n        $this-&gt;elementRenderer   = $elementRenderer;\n        $this-&gt;objectManager     = $objectManager;\n        $this-&gt;storeManager      = $context-&gt;getStoreManager();\n        $this-&gt;dataObjectFactory = $dataObjectFactory;\n        $this-&gt;attributeMetadataDataProvider = $attributeMetadataDataProvider;\n    }\n\n    \/**\n     * Check whether attribute is visible on front\n     *\n     * @param Attribute $attribute\n     *\n     * @return bool\n     *\/\n    public function isAttributeVisibleOnFront(Attribute $attribute)\n    {\n        return $attribute-&gt;getIsVisible();\n    }\n\n    protected function _prepareForm()\n    {\n        \/** @var \\Magento\\Framework\\Data\\Form $form *\/\n        $form = $this-&gt;_formFactory-&gt;create();\n        $type = &#039;customer_attributes_registration&#039;;\n\n        $attributes = $this-&gt;attributeMetadataDataProvider-&gt;loadAttributesCollection(\n            &#039;customer&#039;,\n            $type\n        );\n\n        if (!$attributes || !$attributes-&gt;getSize()) {\n            return;\n        }\n        $fieldset = $form-&gt;addFieldset(\n            &#039;group-fields-customer-attributes&#039;,\n            &#091;\n                &#039;class&#039; =&gt; &#039;user-defined&#039;,\n                &#039;legend&#039; =&gt; __(&#039;Additional Information&#039;)\n            ]\n        );\n        $fieldset-&gt;setRenderer($this-&gt;fieldsetRenderer);\n\n        $this-&gt;_setFieldset($attributes, $fieldset);\n        $this-&gt;prepareDependentAttributes($attributes, $fieldset);\n\n        $this-&gt;setForm($form);\n    }\n\n    \/**\n     * @inheritdoc\n     *\/\n    protected function _initFormValues()\n    {\n        if ($form = $this-&gt;getForm()) {\n            if ($this-&gt;getCustomerData()) {\n                $form-&gt;addValues($this-&gt;getCustomerData());\n            }\n            \/** @var \\Magento\\Customer\\Block\\Form\\Register $registerForm *\/\n            $registerForm = $this-&gt;getLayout()-&gt;getBlock(&#039;customer_form_register&#039;);\n            if (is_object($registerForm) &amp;&amp; $registerForm-&gt;getFormData() instanceof \\Magento\\Framework\\DataObject) {\n                $form-&gt;addValues($registerForm-&gt;getFormData()-&gt;getData());\n            }\n        }\n\n        return parent::_initFormValues();\n    }\n\n    \/**\n     * Set Fieldset to Form\n     *\n     * @param array|\\Magento\\Customer\\Model\\ResourceModel\\Form\\Attribute\\Collection $attributes\n     * $attributes - attributes that will be added\n     * @param \\Magento\\Framework\\Data\\Form\\Element\\Fieldset $fieldset\n     * @param array $exclude\n     * @return void\n     *\/\n    protected function _setFieldset($attributes, $fieldset, $exclude = &#091;])\n    {\n        $this-&gt;_addElementTypes($fieldset);\n\n        foreach ($attributes as $attribute) {\n            \/** @var $attribute \\Magento\\Eav\\Model\\Entity\\Attribute *\/\n            if (!$this-&gt;isAttributeVisibleOnFront($attribute)) {\n                continue;\n            }\n            $attribute-&gt;setStoreId($this-&gt;storeManager-&gt;getStore()-&gt;getId());\n\n            if ($inputType = $attribute-&gt;getFrontend()-&gt;getInputType()) {\n                $rendererClass = $attribute-&gt;getFrontend()-&gt;getInputRendererClass();\n                \n                if ($inputType == &quot;boolean&quot;) {\n                    $fieldType = &#039;Webkul\\CustomModule\\Block\\Data\\Form\\Element\\\\&#039; . ucfirst($inputType);\n                } else {\n                    $fieldType = &#039;Magento\\Framework\\Data\\Form\\Element\\\\&#039; . ucfirst($inputType);\n                }\n                \n                if (!empty($rendererClass)) {\n                    $fieldType = $inputType . &#039;_&#039; . $attribute-&gt;getAttributeCode();\n                    $fieldset-&gt;addType($fieldType, $rendererClass);\n                }\n\n                $data = &#091;\n                    &#039;name&#039; =&gt; $attribute-&gt;getAttributeCode(),\n                    &#039;label&#039; =&gt; $attribute-&gt;getStoreLabel(),\n                    &#039;class&#039; =&gt; $attribute-&gt;getFrontend()-&gt;getClass(),\n                    &#039;required&#039; =&gt; $attribute-&gt;getIsRequired() || $attribute-&gt;getRequiredOnFront(),\n                    &#039;note&#039; =&gt; $attribute-&gt;getNote()\n                ];\n               \n                $element = $fieldset-&gt;addField(\n                    $attribute-&gt;getAttributeCode(),\n                    $fieldType,\n                    $data\n                )-&gt;setEntityAttribute(\n                    $attribute\n                );\n\n                $element-&gt;setValue($attribute-&gt;getDefaultValue());\n                $element-&gt;setRenderer($this-&gt;elementRenderer);\n                $element-&gt;setAfterElementHtml($this-&gt;_getAdditionalElementHtml($element));\n\n                \/* add options format *\/\n                $this-&gt;_applyTypeSpecificConfig($inputType, $element, $attribute);\n            }\n        }\n    }\n\n    \/**\n     * {@inheritdoc}\n     *\/\n    protected function _applyTypeSpecificConfig($inputType, $element, Attribute $attribute)\n    {\n        switch ($inputType) {\n            case &#039;select&#039;:\n                $element-&gt;addElementValues($attribute-&gt;getSource()-&gt;getAllOptions(true, false));\n                break;\n            case &#039;multiselect&#039;:\n                $element-&gt;addElementValues($attribute-&gt;getSource()-&gt;getAllOptions(false, false));\n                $element-&gt;setCanBeEmpty(true);\n                break;\n            default:\n                break;\n        }\n    }\n\n    \/**\n     * @param \\Magento\\Customer\\Model\\ResourceModel\\Form\\Attribute\\Collection $attributes\n     * @param \\Magento\\Framework\\Data\\Form\\Element\\Fieldset $fieldset\n     *\/\n    protected function prepareDependentAttributes($attributes, $fieldset)\n    {\n        $depends = &#091;];\n        $attributeIds = $attributes-&gt;getColumnValues(&#039;attribute_id&#039;);\n        if (empty($attributeIds)) {\n            return;\n        }\n       \n        \/\/you can add array options dynamically as per your need\n        $depends&#091;] = &#091;\n            &#039;parent_attribute_id&#039; =&gt; 163,\n            &#039;parent_attribute_code&#039; =&gt; &#039;wk_custom_want_to_add_aadhaar&#039;,\n            &#039;parent_option_id&#039; =&gt; 1,\n            &#039;depend_attribute_id&#039; =&gt; 162,\n            &#039;depend_attribute_code&#039; =&gt; &#039;wk_custom_aadhaar_number&#039;\n        ];\n      \n        if (!empty($depends)) {\n            $fieldset-&gt;setData(&#039;depends&#039;, $depends);\n        }\n    }\n\n    \/**\n     * @return array\n     *\/\n    private function getCustomerData()\n    {\n        if (!isset($this-&gt;_customerData)) {\n            $this-&gt;_customerData = &#091;];\n            if ($this-&gt;session-&gt;isLoggedIn()) {\n                $this-&gt;_customerData = $this-&gt;session-&gt;getCustomer()-&gt;getData();\n            }\n        }\n\n        return $this-&gt;_customerData;\n    }\n}<\/pre>\n\n\n\n<p><strong>11.<\/strong> Now, run the following commands.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php bin\/magento setup:upgrade\n\nphp bin\/magento setup:static-content:deploy\n\nphp bin\/magento cache:flush<\/pre>\n\n\n\n<p><strong>12.<\/strong> Now, check the result(refer to the following images):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"439\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png\" alt=\"customAttributesInDb\" class=\"wp-image-306069\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-300x110.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-250x91.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-768x281.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1536x562.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb.png 1782w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"281\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb-1200x281.png\" alt=\"patchListinDb\" class=\"wp-image-306070\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb-1200x281.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb-300x70.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb-250x58.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb-768x180.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb-1536x359.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/patchListinDb.png 1835w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"820\" height=\"1024\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-820x1024.png\" alt=\"Create-New-Custo\" class=\"wp-image-306071\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-820x1024.png 820w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-240x300.png 240w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-199x249.png 199w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-768x960.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-1229x1536.png 1229w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-1639x2048.png 1639w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo.png 1920w\" sizes=\"(max-width: 820px) 100vw, 820px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"790\" height=\"1024\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-790x1024.png\" alt=\"Create-New-Custo-2\" class=\"wp-image-306072\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-790x1024.png 790w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-231x300.png 231w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-192x249.png 192w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-768x996.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-1185x1536.png 1185w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2-1580x2048.png 1580w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/Create-New-Custo-2.png 1920w\" sizes=\"(max-width: 790px) 100vw, 790px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Hope this will be helpful. Thanks \ud83d\ude42<\/p>\n\n\n\n<p><strong>Next Blog:<\/strong> <a href=\"https:\/\/webkul.com\/blog\/display-dependent-fields-on-customer-account-edit-page\/\" target=\"_blank\" rel=\"noreferrer noopener\">Display dependent fields on the customer account edit page.<\/a><br><br><strong>Previous Blog: <\/strong><a href=\"https:\/\/webkul.com\/blog\/make-submenu-position-right-adjacent-of-parent-menu-at-frontend-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Make Submenu position right adjacent of parent menu at frontend in Magento 2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends!In this blog, we are going to learn how we can create dependent fields for custom customer attributes on the customer registration form at the frontend. In Magento 2, sometimes we need to get some additional information from customers.For example, if we want to know from where customers got this reference of our store, <a href=\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":249,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121],"tags":[1230,12074,460,12073,1335,12072],"class_list":["post-306063","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-custom-attribute","tag-custom-customer-attributes","tag-custom-customer-fields","tag-dependent-attributes","tag-dependent-custom-option","tag-dependent-fields"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Dependent Attribute Fields on Customer Registration Form - Webkul Blog<\/title>\n<meta name=\"description\" content=\"how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Dependent Attribute Fields on Customer Registration Form - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-19T16:22:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-26T10:29:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png\" \/>\n<meta name=\"author\" content=\"Khushboo Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khushboo Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\"},\"author\":{\"name\":\"Khushboo Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\"},\"headline\":\"Create Dependent Attribute Fields on Customer Registration Form\",\"datePublished\":\"2021-09-19T16:22:56+00:00\",\"dateModified\":\"2024-07-26T10:29:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\"},\"wordCount\":420,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png\",\"keywords\":[\"custom attribute\",\"custom customer attributes\",\"custom customer fields\",\"dependent attributes\",\"dependent custom option\",\"dependent fields\"],\"articleSection\":[\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\",\"url\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\",\"name\":\"Create Dependent Attribute Fields on Customer Registration Form - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png\",\"datePublished\":\"2021-09-19T16:22:56+00:00\",\"dateModified\":\"2024-07-26T10:29:20+00:00\",\"description\":\"how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb.png\",\"width\":1782,\"height\":652,\"caption\":\"customAttributesInDb\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Dependent Attribute Fields on Customer Registration Form\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\",\"name\":\"Khushboo Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Khushboo Sahu\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Dependent Attribute Fields on Customer Registration Form - Webkul Blog","description":"how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/","og_locale":"en_US","og_type":"article","og_title":"Create Dependent Attribute Fields on Customer Registration Form - Webkul Blog","og_description":"how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.","og_url":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2021-09-19T16:22:56+00:00","article_modified_time":"2024-07-26T10:29:20+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png","type":"","width":"","height":""}],"author":"Khushboo Sahu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Khushboo Sahu","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/"},"author":{"name":"Khushboo Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca"},"headline":"Create Dependent Attribute Fields on Customer Registration Form","datePublished":"2021-09-19T16:22:56+00:00","dateModified":"2024-07-26T10:29:20+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/"},"wordCount":420,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png","keywords":["custom attribute","custom customer attributes","custom customer fields","dependent attributes","dependent custom option","dependent fields"],"articleSection":["Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/","url":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/","name":"Create Dependent Attribute Fields on Customer Registration Form - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb-1200x439.png","datePublished":"2021-09-19T16:22:56+00:00","dateModified":"2024-07-26T10:29:20+00:00","description":"how we can create dependent fields for custom customer attributes on the customer registration form at the frontend.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/customAttributesInDb.png","width":1782,"height":652,"caption":"customAttributesInDb"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/create-dependent-attribute-fields-on-customer-registration-form\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create Dependent Attribute Fields on Customer Registration Form"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca","name":"Khushboo Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Khushboo Sahu"},"url":"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/306063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/249"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=306063"}],"version-history":[{"count":9,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/306063\/revisions"}],"predecessor-version":[{"id":454987,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/306063\/revisions\/454987"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=306063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=306063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=306063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}