{"id":45352,"date":"2016-04-09T14:30:56","date_gmt":"2016-04-09T14:30:56","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=45352"},"modified":"2026-01-02T06:27:09","modified_gmt":"2026-01-02T06:27:09","slug":"add-value-customer-custom-attribute","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/","title":{"rendered":"Set value of Customer Custom attribute in Magento 2"},"content":{"rendered":"\n<p>Magento 2 allows store owners and developers to extend customer information using a <strong>custom attribute in Magento<\/strong>. <\/p>\n\n\n\n<p>Customer custom attributes are widely used to store additional data such as preferences, loyalty details, verification status, or any business-specific information that is not available by default.<\/p>\n\n\n\n<p>In this blog, we will explain how to set or update the value of a customer custom attribute in Magento 2 programmatically.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Use Customer Custom Attribute in Magento?<\/h2>\n\n\n\n<p>Using a <strong>custom attribute in Magento<\/strong> helps you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Store additional customer-specific data<\/li>\n\n\n\n<li>Manage dynamic values after customer login<\/li>\n\n\n\n<li>Integrate external systems with Magento customer data<\/li>\n\n\n\n<li>Automate updates based on customer actions<\/li>\n\n\n\n<li>Improve personalization and user experience<\/li>\n<\/ul>\n\n\n\n<p>Magento 2 <span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">offers APIs to securely manage customer data using the\u00a0<strong>repository pattern<\/strong>, ensuring<\/span> scalability and future compatibility.<\/p>\n\n\n\n<p><br>To know how to create custom attributes for a customer, you can check the following:<br>1. Using Installer\/Patch, click <a href=\"https:\/\/webkul.com\/blog\/how-to-create-customer-custom-attribute-in-magento-2-0\/\">here<\/a><br>2. Without using Installer\/Patch, click <a href=\"https:\/\/webkul.com\/blog\/create-customer-attribute-without-using-installer\/\">here<\/a><\/p>\n\n\n\n<p>We will use a Controller file to set the value of custom attributes. <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace Webkul\\CustomerAttribute\\Controller\\Account;\n\nuse Magento\\Framework\\App\\Action\\Context;\nuse Magento\\Framework\\Data\\Form\\FormKey\\Validator as FormKeyValidator;\nuse Magento\\Framework\\View\\Result\\PageFactory;\nuse Magento\\Customer\\Api\\CustomerRepositoryInterface;\nuse Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory;\nuse Magento\\Framework\\App\\RequestInterface;\nuse Magento\\Framework\\Api\\DataObjectHelper;\n\nclass SavePrice extends \\Magento\\Customer\\Controller\\AbstractAccount\n{\n    \/**\n     * @var \\Magento\\Customer\\Model\\Session\n     *\/\n    protected $_customerSession;\n\n    \/**\n     * @var \\Magento\\Framework\\Data\\Form\\FormKey\\Validator\n     *\/\n    protected $_formKeyValidator;\n\n    \/** @var CustomerRepositoryInterface *\/\n    protected $_customerRepository;\n    \/**\n     * @var \\Magento\\Customer\\Model\\Customer\\Mapper\n     *\/\n    protected $_customerMapper;\n    \/**\n     * @var CustomerInterfaceFactory\n     *\/\n    protected $_customerDataFactory;\n    \/**\n     * @var DataObjectHelper\n     *\/\n    protected $_dataObjectHelper;\n\n    \/**\n     * @param Context $context\n     * @param Session $customerSession\n     * @param FormKeyValidator $formKeyValidator\n     * @param CustomerRepositoryInterface $customerRepository\n     * @param CustomerInterfaceFactory $customerDataFactory\n     * @param DataObjectHelper $dataObjectHelper\n     * @param \\Magento\\Customer\\Model\\Customer\\Mapper $customerMapper\n     * @param PageFactory $resultPageFactory\n     *\/\n    public function __construct(\n        Context $context,\n        \\Magento\\Customer\\Model\\Session $customerSession,\n        FormKeyValidator $formKeyValidator,\n        CustomerRepositoryInterface $customerRepository,\n        CustomerInterfaceFactory $customerDataFactory,\n        DataObjectHelper $dataObjectHelper,\n        \\Magento\\Customer\\Model\\Customer\\Mapper $customerMapper,\n        PageFactory $resultPageFactory\n    ) {\n        $this-&gt;_customerSession = $customerSession;\n        $this-&gt;_customerRepository = $customerRepository;\n        $this-&gt;_customerMapper = $customerMapper;\n        $this-&gt;_customerDataFactory = $customerDataFactory;\n        $this-&gt;_dataObjectHelper = $dataObjectHelper;\n        $this-&gt;_formKeyValidator = $formKeyValidator;\n        parent::__construct(\n            $context\n        );\n    }\n\n    \/**\n     * Retrieve customer session object\n     *\n     * @return \\Magento\\Customer\\Model\\Session\n     *\/\n    protected function _getSession()\n    {\n        return $this-&gt;_customerSession;\n    }\n\n    \/**\n     * Check customer authentication\n     *\n     * @param RequestInterface $request\n     * @return \\Magento\\Framework\\App\\ResponseInterface\n     *\/\n    public function dispatch(RequestInterface $request)\n    {\n        $loginUrl = $this-&gt;_objectManager-&gt;get(&#039;Magento\\Customer\\Model\\Url&#039;)-&gt;getLoginUrl();\n\n        if (!$this-&gt;_customerSession-&gt;authenticate($loginUrl)) {\n            $this-&gt;_actionFlag-&gt;set(&#039;&#039;, self::FLAG_NO_DISPATCH, true);\n        }\n        return parent::dispatch($request);\n    }\n\n    \/**\n     * Default customer account page\n     *\n     * @return \\Magento\\Framework\\View\\Result\\Page\n     *\/\n    public function execute()\n    {\n        \/** @var \\Magento\\Framework\\Controller\\Result\\Redirect $resultRedirect *\/\n        $resultRedirect = $this-&gt;resultRedirectFactory-&gt;create();\n\n        if ($this-&gt;getRequest()-&gt;isPost()) {\n            if (!$this-&gt;_formKeyValidator-&gt;validate($this-&gt;getRequest())) {\n                return $this-&gt;resultRedirectFactory-&gt;create()-&gt;setPath(\n                    &#039;*\/*\/index&#039;,\n                    &#091;&#039;_secure&#039; =&gt; $this-&gt;getRequest()-&gt;isSecure()]\n                );\n            }\n            $customerData = $this-&gt;getRequest()-&gt;getParams(); \/\/get attributes value from form\n            $customerId = $this-&gt;_getSession()-&gt;getCustomerId();\n            \/\/ get customer saved data\n            $savedCustomerData = $this-&gt;_customerRepository-&gt;getById($customerId);\n            $customer = $this-&gt;_customerDataFactory-&gt;create();\n            \/\/merge saved customer data with new values\n            $customerData = array_merge(\n                $this-&gt;_customerMapper-&gt;toFlatArray($savedCustomerData),\n                $customerData\n            );\n            $customerData&#091;&#039;id&#039;] = $customerId;\n            $this-&gt;_dataObjectHelper-&gt;populateWithArray(\n                $customer,\n                $customerData,\n                &#039;\\Magento\\Customer\\Api\\Data\\CustomerInterface&#039;\n            );\n            \/\/save customer\n            $this-&gt;_customerRepository-&gt;save($customer);\n            $this-&gt;messageManager-&gt;addSuccess(__(&#039;Value has been successfully saved&#039;));\n            return $this-&gt;resultRedirectFactory-&gt;create()-&gt;setPath(\n                &#039;*\/*\/index&#039;,\n                &#091;&#039;_secure&#039; =&gt; $this-&gt;getRequest()-&gt;isSecure()]\n            );\n        }\n    }\n}<\/pre>\n\n\n\n<p>By using the same approach, you can set the value for the customer&#8217;s custom attribute.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices to Follow:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always use <strong>CustomerRepositoryInterface<\/strong><\/li>\n\n\n\n<li>Never save customer models directly<\/li>\n\n\n\n<li>Validate customer login before updating data<\/li>\n\n\n\n<li>Handle exceptions properly<\/li>\n\n\n\n<li>Keep attribute codes consistent and meaningful<\/li>\n\n\n\n<li>Use clean and maintainable controller logic<\/li>\n<\/ul>\n\n\n\n<p>Setting the value of a <strong>custom attribute in Magento<\/strong> is an essential feature for advanced customer data management. <\/p>\n\n\n\n<p>By using a custom controller and Magento\u2019s repository pattern, you can safely update customer attributes while maintaining performance and scalability.<\/p>\n\n\n\n<p>This approach enables you to extend Magento\u2019s customer functionality without modifying core files, keeping your implementation aligned with Magento development standards.<\/p>\n\n\n\n<p>For technical assistance, please get in touch with us via email at&nbsp;<a href=\"mailto:support@webkul.com\" target=\"_blank\" rel=\"noreferrer noopener\">support@webkul.com<\/a>.<\/p>\n\n\n\n<p>Discover powerful solutions to enhance your Magento 2 store by exploring our&nbsp;<a href=\"https:\/\/store.webkul.com\/Magento-2.html\">Magento 2 plugins<\/a>&nbsp;page.<\/p>\n\n\n\n<p>Bring your vision to life with custom-built solutions\u2014hire skilled&nbsp;<a href=\"https:\/\/webkul.com\/hire-magento-developers\/\">Magento 2 developers<\/a>&nbsp;today.<br>Happy Coding!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 allows store owners and developers to extend customer information using a custom attribute in Magento. Customer custom attributes are widely used to store additional data such as preferences, loyalty details, verification status, or any business-specific information that is not available by default. In this blog, we will explain how to set or update <a href=\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":69,"featured_media":43620,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[2955,2956],"class_list":["post-45352","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento2","tag-magento-2-customer-attribute","tag-set-custom-customer-attribute-value"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Set value of Customer Custom attribute in Magento 2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Learn how to set customer custom attribute values in Magento 2 using a custom module and controller while following Magento best practices.\" \/>\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\/add-value-customer-custom-attribute\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set value of Customer Custom attribute in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Learn how to set customer custom attribute values in Magento 2 using a custom module and controller while following Magento best practices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\" \/>\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=\"2016-04-09T14:30:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-02T06:27:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Mahesh Singh\" \/>\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=\"Mahesh Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\"},\"author\":{\"name\":\"Mahesh Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd\"},\"headline\":\"Set value of Customer Custom attribute in Magento 2\",\"datePublished\":\"2016-04-09T14:30:56+00:00\",\"dateModified\":\"2026-01-02T06:27:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\"},\"wordCount\":329,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png\",\"keywords\":[\"magento 2 customer attribute\",\"set custom customer attribute value\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\",\"url\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\",\"name\":\"Set value of Customer Custom attribute in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png\",\"datePublished\":\"2016-04-09T14:30:56+00:00\",\"dateModified\":\"2026-01-02T06:27:09+00:00\",\"description\":\"Learn how to set customer custom attribute values in Magento 2 using a custom module and controller while following Magento best practices.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set value of Customer Custom attribute in Magento 2\"}]},{\"@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\/53d3b977a0ab5adcf32aef9f97e595bd\",\"name\":\"Mahesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Mahesh Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/mahesh721\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Set value of Customer Custom attribute in Magento 2 - Webkul Blog","description":"Learn how to set customer custom attribute values in Magento 2 using a custom module and controller while following Magento best practices.","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\/add-value-customer-custom-attribute\/","og_locale":"en_US","og_type":"article","og_title":"Set value of Customer Custom attribute in Magento 2 - Webkul Blog","og_description":"Learn how to set customer custom attribute values in Magento 2 using a custom module and controller while following Magento best practices.","og_url":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-04-09T14:30:56+00:00","article_modified_time":"2026-01-02T06:27:09+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png","type":"image\/png"}],"author":"Mahesh Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Mahesh Singh","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/"},"author":{"name":"Mahesh Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd"},"headline":"Set value of Customer Custom attribute in Magento 2","datePublished":"2016-04-09T14:30:56+00:00","dateModified":"2026-01-02T06:27:09+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/"},"wordCount":329,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png","keywords":["magento 2 customer attribute","set custom customer attribute value"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/","url":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/","name":"Set value of Customer Custom attribute in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png","datePublished":"2016-04-09T14:30:56+00:00","dateModified":"2026-01-02T06:27:09+00:00","description":"Learn how to set customer custom attribute values in Magento 2 using a custom module and controller while following Magento best practices.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/03\/Magneto-Code-Snippet-1.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/add-value-customer-custom-attribute\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Set value of Customer Custom attribute in Magento 2"}]},{"@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\/53d3b977a0ab5adcf32aef9f97e595bd","name":"Mahesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Mahesh Singh"},"url":"https:\/\/webkul.com\/blog\/author\/mahesh721\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/45352","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\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=45352"}],"version-history":[{"count":10,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/45352\/revisions"}],"predecessor-version":[{"id":520267,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/45352\/revisions\/520267"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/43620"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=45352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=45352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=45352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}