Save or update information in custom fields set to customer's profile

I am adapting the store front API to add custom fields for a customer’s profile. I already added the custom fields in the system settings of the shop, however, I am not able to POST via the API the information in these custom fields, nor update it in the update endpoint.

No matter how I send the information in the requests, the API just ignores it and saves all the other information.

Is this even possible? Or am I just doing it wrong?

Did you modify the store front API or did you extend the customer entity? The second way ist the way to go. Or do you mean you just use the custom_fields of customer?

To be honest I am relatively new to Shopware, though I have a lot of experience regarding PHP or even REST API’s.

I did add a custom field attached to the customer’s profile. I see the custom field in the customer’s page, I can edit it as well.

The problem is, when I add this custom field information in the POST request to create a new customer, it just gets ignored and it doesn’t get saved. In the response, I get the million and one fields for such customer, and in the end I also see: customFields: null, meaning my field got ignored.

It is German, but maybe you can read the PHP… I hope it helps.

https://shopware.stoplight.io/docs/admin-api/ZG9jOjEyMzA4NTQ5-writing-entities

Thanks for the information. I have already tried via the admin panel, to see how the admin backend does it.

Funny enough, that endpoint I am not able to call as an „admin“. I have to be the logged in user to perform such action, then I am able to „edit“ that field. My problem, for the moment, relies somewhere else.

This field just is completely ignored in my POST calls. I am not able also to do any editing via the API, as there is no „profile change“ via the API, only to change information as the same logged in user.

Also what I have noticed, is that I am not able to add at first the custom fields via the admin panel. They are not there. I have to first create the customer, then in the editing section I AM indeed able to see these fields. Could it be realted to this?

Thanks for your support.

What do you mean with admin and user? A customer, registered at the frontend or a backend user, added in addition to the admin?

User for me is a customer. Admin is me, the developer and the one that has access to the admin platform.

What I am trying to achieve, is:

  • Customers that create an account in my website/web app/ mobile app, are asked afterwards to fill out additional information regarding their profile.
  • The only way I can think of saving this additional information is in a custom field, attached to the customer’s information.
  • The idea is, after a customer „clicks“ on „Create Account“, after of course they have filled out all the information, is to call the register endpoint and save both the customer information and the additional information in the custom field.

So far, creating an account works good, but the additional information that I want to save in the custom field just doesn’t work and gets ignored by Shopware’s system.

TL;DR: I am not able to save custom fields in the register endpoint of customers. Still.