Update Parties
Abstract
Developer tasks for using service method UpdateParties
.
UpdateParties
is used to update party information in an existing cart.
At your Visual Studio solution setup:
Reference the Sitecore.Commerce.Connect.CommerceServer and Sitecore.Commerce.dll.
Pick the class in your solution where want to use this service method.
Paste in the code below to use the service method.
var customerService = new CustomerServiceProvider(); // create a customer var customer = customerService.CreateCustomer( new CreateCustomerRequest( new CommerceCustomer { Name = "Jeff" , Shops = new [] { "autohaus" }, ExternalId = "1234567890" })).CommerceCustomer; var parties = new List <Party> { new Party {ExternalId = "1234567890" , Address1 = "123 My Street" , City = "My City" , Country = "My Country" , PartyId = "1" } }; // add the party var addRequest = new AddPartiesRequest(customer, parties); var addResult = customerService.AddParties(addRequest); parties.Add( new Party { ExternalId = "9876543210" , Address1 = "123 My Road" , City = "My Town" , Country = "Your Country" , PartyId = "2" }); // update the parties var updateRequest = new UpdatePartiesRequest(customer, parties); var getResult = customerService.UpdateParties(updateRequest);