Answer the question
In order to leave comments, you need to log in
How to change the buyer's profile in an order using the Bitrix API?
The situation is as follows: in an already formed order, it is necessary to change the buyer's profile from one to another (namely, the buyer's profile that is linked to the user, and not the user himself!). This can be done in the administrative section in the order editing mode, but in my situation it is necessary to implement this functionality through the Bitrix API.
In the method CSaleOrder::Update($orderID, $arFields)
in the arFields array, there is no Buyer Profile field, there is only USER_ID
that there is a User ID.
There is a function Sale\Helpers\Admin\OrderEdit::saveProfileData
. But not quite figured out what exactly she wants as arguments.
Question: how can I change the profile through the API?
Answer the question
In order to leave comments, you need to log in
The user profile is not saved in the order, during checkout, data from the specified profile is copied to the order properties and that's it. In the admin panel, if you do not change the user, then you cannot select a profile while editing an order, you can only correct the properties of the order. If we change the user or create a new order, then you can select a profile. The \Bitrix\Sale\Helpers\Admin\OrderEdit::saveProfileData() function saves the profile itself, not the order properties.
In your case, you need to take property values from another profile and assign them instead of the current ones.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question