question

wsadiq avatar image
wsadiq asked sam Deactivated commented

clear customer form order

Hello,

I am trying to clear a customer that was attached to an order. I am calling the following code but it does not seem to be working.

Order currentOrder = orderConnector.getOrder(ordeId);
currentOrder.clearCustomers();
orderConnector.updateOrder(currentOrder);

Can you please help.

OrdersCustomers
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sam avatar image sam commented ·

It doesn't seem like you can clear a customer from an existing order at the moment. You will need to delete and recreate the order with a different customer. I will post a request for this feature.

0 Likes 0 ·

1 Answer

wsadiq avatar image
wsadiq answered sam Deactivated commented

This seems to be working for me.

List<com.clover.sdk.v3.customers.Customer> customers = new ArrayList<>();
currentOrder.setCustomers(customers);
orderConnector.updateOrder(currentOrder);

Is this workaround OK?

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sam avatar image sam commented ·

That seems like a good work around. Thanks for sharing.

0 Likes 0 ·

Welcome to the
Clover Developer Community