Is there anyway to change the customer on a purchase order? I can't find any support for this in the Manager, can it be done by code instead?
I haven't tested changing this after the order has been created, but PurchaseOrder has a property CustomerId you can set. You need to check how this affect existing order data such as shipping and billing address.
Why would you want to change the customer and which values do you want to change?
Thanks for your replies.
A customer can buy without being logged in. If that happens we would like to connect the purchase order to the correct user and organization and remove the temporarily created on. Is that possible?
In that case it's entirely possible. In facts, when a customer places orders as anonymous, then logs in, the ProfileModule will automatically update the last orders to the contact.
So I think this can be done:
order.CustomerId = customerContact.PrimaryKeyId ?? Guid.Empty;
order.CustomerName = customerContact.FullName;
I can confirm that that is possible, yes. You could typically have a registration form on your order receipt page and then connect the newly created order as part of the registration process.
Of course! The CustomerId is a Contact and not an Organization so just by moving the created contact to the correct organization the connection will be correct. If the customer already has an account we can use Quans code above to "move" the purcahse order.