I have an observer for the event when an order is placed by a customer. I tried "sales_model_service_quote_submit_before"
I would like to take a value from the Order and save it to the customer.
For example.
$customer = $quote->getCustomer();
if ($customer) {
$customer->setData('someValue', $quote->getData('someValue')))
$customer->save();
}
I have also tried
$customerId = $quote->getCustomerId();
if ($customerId) {
$customer = $customerRepository->getById($customerId);
$customer->setSomeValue('1234');
$customer->save();
}
Can someone please provide an example of an observer to do this correctly?