Browse Source

fix(core): Prevent countryCode exception when adding payment to order

Michael Bromley 5 years ago
parent
commit
49c2ad4d53
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/core/src/api/resolvers/shop/shop-order.resolver.ts

+ 1 - 1
packages/core/src/api/resolvers/shop/shop-order.resolver.ts

@@ -278,7 +278,7 @@ export class ShopOrderResolver {
                         );
                         );
                         // If the Customer has no addresses yet, use the shipping address data
                         // If the Customer has no addresses yet, use the shipping address data
                         // to populate the initial default Address.
                         // to populate the initial default Address.
-                        if (addresses.length === 0) {
+                        if (addresses.length === 0 && order.shippingAddress?.country) {
                             const address = order.shippingAddress;
                             const address = order.shippingAddress;
                             await this.customerService.createAddress(ctx, order.customer.id as string, {
                             await this.customerService.createAddress(ctx, order.customer.id as string, {
                                 ...address,
                                 ...address,