File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class OminityApiClient
1818 /**
1919 * Version of our client.
2020 */
21- public const CLIENT_VERSION = "1.3.1 " ;
21+ public const CLIENT_VERSION = "1.3.2 " ;
2222
2323 /**
2424 * Endpoint of the remote API.
Original file line number Diff line number Diff line change @@ -319,16 +319,18 @@ public function update()
319319 "currency " => $ this ->currency ,
320320 "country " => $ this ->country ,
321321 "shippingMethodId " => $ this ->shippingMethodId ,
322- "items " => array_map (function ($ item ) {
322+ "items " => array_values (array_filter (array_map (function ($ item ) {
323+ if (!is_object ($ item ) || empty ($ item ->productId )) {
324+ return null ;
325+ }
326+
323327 return array_filter ([
324328 "id " => $ item ->id ?? null ,
325329 "productId " => $ item ->productId ,
326330 "productOfferId " => $ item ->productOfferId ?? null ,
327331 "quantity " => $ item ->quantity ?? 1 ,
328- ], function ($ value ) {
329- return $ value !== null ;
330- });
331- }, $ this ->items ),
332+ ], static fn ($ value ) => $ value !== null );
333+ }, is_array ($ this ->items ) ? $ this ->items : []))),
332334 "billingAddress " => $ this ->billingAddress ?? [],
333335 "shippingAddress " => $ this ->shippingAddress ?? [],
334336 "promotionCodes " => $ this ->promotionCodes ?? [],
You can’t perform that action at this time.
0 commit comments