When magento2 store has 3rd parties system integration then we might be need to store 3rd parties data in magento to make relationships.
We might be need additional attribute to save 3rd parties data in magento 2. Here is post for create new customer attribute in magento2.
https://www.magedad.com/magento-2-create-a-customer-attribute-programmatically-using-setup-data-patch/
1. Get Custom Customer Attribute Value Programatically
/* Magento\Customer\Api\CustomerRepositoryInterface */
$customer = $this->customerRepository->getById($customerId);
$externalIdAttribute = $customer->getCustomAttribute('external_id');
if ($externalIdAttribute) {
$externalId = $externalIdAttribute->getValue();
}
2. Save Custom Customer Attribute Value Programatically
/* Magento\Customer\Api\CustomerRepositoryInterface */
$customer = $this->customerRepository->getById($customerId);
$customer->setCustomAttribute('external_id', 'ABC123');
$this->customerRepository->save($customer);
That’s it. We also have other customer related post might be it’s help to you.
- How to create customer using REST API?
- Create a customer address attribute programmatically using setup data patch
You can follow this link for more help.
I hope this blog is useful to set/get customer attribute value in magento2 and save. In case, I missed anything or need to add some more information, Don’t heisted to leave a comment in this blog, I’ll get back with some positive approach.
Keep liking 👍 Keep sharing 📣 Keep loving ❤️ Keep inspiring 🤩
29 Comments
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.com/register?ref=P9L9FQKY
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.info/register?ref=P9L9FQKY
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your article helped me a lot, is there any more related content? Thanks!
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.com/register-person?ref=P9L9FQKY
Thank you, your article surprised me, there is such an excellent point of view. Thank you for sharing, I learned a lot.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Searching for trusted roof installation in Lancaster? Roof Installation Pros provides expert services across all roofing styles. Their experienced team guarantees strong, lasting installations that enhance your home’s protection and market value. Excellent service, always on time and within budget.
Get reliable roof installation services in Lancaster with Roof Installation Pros. Whether it’s a new roof or a replacement, their experienced crew delivers quality craftsmanship that lasts. Known for fair pricing and dependable results that boost home value—your roof is in safe hands.
Searching for trusted roof installation in Lancaster? Roof Installation Pros provides expert services across all roofing styles. Their experienced team guarantees strong, lasting installations that enhance your home’s protection and market value. Excellent service, always on time and within budget.
For dependable and expert roof installation services in Lancaster, Roof Installation Pros is your go-to choice. They specialize in all roofing types, delivering lasting solutions that safeguard your property and boost its value. Count on them for affordable, high-quality, and on-time service.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://accounts.binance.com/register?ref=P9L9FQKY
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://accounts.binance.info/en-IN/register-person?ref=UM6SMJM3
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.com/en-NG/register?ref=JHQQKNKN
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://www.binance.com/id/register?ref=GJY4VW8W