File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
WooCommerce/Classes/ViewRelated/Orders/Order Creation/Synchronizer Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ final class LocalOrderSynchronizer: OrderSynchronizer {
5656 /// Creates the order remotely.
5757 ///
5858 func commitAllChanges( onCompletion: @escaping ( Result < Order , Error > ) -> Void ) {
59- let action = OrderAction . createOrder ( siteID: siteID, order: order, onCompletion: onCompletion)
59+ let action = OrderAction . createOrder ( siteID: siteID, order: order. removingItemIDs ( ) , onCompletion: onCompletion)
6060 stores. dispatch ( action)
6161 }
6262}
@@ -112,3 +112,14 @@ private extension LocalOrderSynchronizer {
112112 return input. updating ( id: Int64 ( UUID ( ) . uuidString. hashValue) )
113113 }
114114}
115+
116+ // MARK: Order Helpers
117+ private extension Order {
118+ /// Removes the `itemID` values from items.
119+ /// This is needed to create the item without the random generated ID, the remote API would fail otherwise.
120+ func removingItemIDs( ) -> Order {
121+ copy (
122+ items: items. map { $0. copy ( itemID: . zero, subtotal: " " , total: " " ) }
123+ )
124+ }
125+ }
You can’t perform that action at this time.
0 commit comments