---
title: "How to fix issue of saving custom customer attribute value programmatically in Magento 2"
url: "https://magecomp.com/blog/fix-issue-saving-custom-customer-attribute-value-programmatically-magento-2/"
date: "2018-06-14T18:17:39+00:00"
modified: "2025-02-21T10:35:31+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 210
reading_time: "2 min read"
summary: "Every Business is different that’s why the information that is stored &amp; proceed by business is different too. Being featured pack CMS, Magento allows the store owner to create, store and proc..."
description: "Magento 2 allows the store owner to create their own custom attribute to store & process the information to fulfill every business needs. Recently, many deve..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Disable the PageBuilder Module for a Specific Field in Magento 2"
    url: "https://magecomp.com/blog/disable-pagebuilder-module-for-specific-field-magento-2/"
  - title: "What’s the difference between Allowed Countries, EU Countries, and Top Destinations in Magento?"
    url: "https://magecomp.com/blog/difference-between-allowed-eu-and-top-countries-in-magento/"
  - title: "Magento 2: Customize Checkout Order Summary by Adding Custom Content"
    url: "https://magecomp.com/blog/magento-2-customize-checkout-order-summary-by-adding-custom-content/"
---

# How to fix issue of saving custom customer attribute value programmatically in Magento 2

_Published: June 14, 2018_  
_Author: Dhiren Vasoya_  

![Save custom customer attribute value programmatically M2](https://magecomp.com/blog/wp-content/uploads/2018/06/Save-custom-customer-attribute-value-programmatically-M2-1024x332.webp)

Every Business is different that’s why the information that is stored & proceed by business is different too. Being featured pack CMS, Magento allows the store owner to create, store and proceed their own custom attribute in the database. Basically, an attribute is the property of a product which can be used for fulfilling business needs.

[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-2.webp)](https://magecomp.com/magento-performance-optimization.html)

Recently, developers are facing an issue while saving customer attribute programmatically in Magento 2. It doesn’t show any error while running the script from the root, but when you check the saved attribute it reruns blank. Meanwhile working on extension development and customization we faced this issue multiple times that’s why we decided to fix this issue & we found that even this issue request in pulled by one of Magento developer on Official Magento Github. After spending some time in coding we found a code that did work for us that I am going to share on today’s blog.

Here in this example, we have tried to save custom attribute value using Controller file in custom extension. To fix this issue, firstly we need to create ‘controller.php’ file at below location.

[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-6.webp)](https://magecomp.com/services/hyva-theme-development/)
app\code\Vendor\Extension\Controller\Index

```

Lastly, Comment down below if you face any issue while using this code.
Happy Coding!
```

[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-5.webp)](https://magecomp.com/services/hire-magento-programmer/)


---

_View the original post at: [https://magecomp.com/blog/fix-issue-saving-custom-customer-attribute-value-programmatically-magento-2/](https://magecomp.com/blog/fix-issue-saving-custom-customer-attribute-value-programmatically-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-07-13 04:37:34 UTC_  
