nopSolutions/nopCommerce · error · NopException

Country '{shippingCountry.Name}' is not allowed for shipping

Error message

Country '{shippingCountry.Name}' is not allowed for shipping

What it means

Thrown when the country resolved from the shipping address has AllowsShipping=false, meaning the store is configured to not ship to that destination. This is a business-rule restriction enforced at order placement to prevent orders to unsupported regions.

Source

Thrown at src/Libraries/Nop.Services/Orders/OrderProcessingService.cs:464

                    ZipPostalCode = pickupPoint.ZipPostalCode,
                    CreatedOnUtc = DateTime.UtcNow
                };
            }
            else
            {
                if (details.Customer.ShippingAddressId == null)
                    throw new NopException("Shipping address is not provided");

                var shippingAddress = await _customerService.GetCustomerShippingAddressAsync(details.Customer);

                if (!CommonHelper.IsValidEmail(shippingAddress?.Email))
                    throw new NopException("Email is not valid");

                //clone shipping address
                details.ShippingAddress = _addressService.CloneAddress(shippingAddress);

                if (await _countryService.GetCountryByAddressAsync(details.ShippingAddress) is Country shippingCountry && !shippingCountry.AllowsShipping)
                    throw new NopException($"Country '{shippingCountry.Name}' is not allowed for shipping");
            }

            var shippingOption = await _genericAttributeService.GetAttributeAsync<ShippingOption>(details.Customer,
                NopCustomerDefaults.SelectedShippingOptionAttribute, processPaymentRequest.StoreId);
            if (shippingOption != null)
            {
                details.ShippingMethodName = shippingOption.Name;
                details.ShippingRateComputationMethodSystemName = shippingOption.ShippingRateComputationMethodSystemName;
            }

            details.ShippingStatus = ShippingStatus.NotYetShipped;
        }
        else
            details.ShippingStatus = ShippingStatus.ShippingNotRequired;
    }

    /// <summary>
    /// Prepare and validate shopping cart and checkout attributes

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. In admin (Configuration > Countries), enable 'Allows shipping' for the customer's destination country.
  2. If shipping is intentionally blocked, inform the customer and offer alternative delivery or pickup options.
  3. Add a checkout-time validation that filters shipping address countries by AllowsShipping to catch this before the payment step.
  4. Audit country settings after any geographic policy change.

Example fix

// before (admin): country.AllowsShipping = false
// after: country.AllowsShipping = true;
await _countryService.UpdateCountryAsync(country);
Defensive patterns

Strategy: validation

Validate before calling

// Before PlaceOrder, check if the shipping country allows shipping
var shippingAddress = await _customerService.GetCustomerShippingAddressAsync(customer);
var country = await _countryService.GetCountryByAddressAsync(shippingAddress);
if (country != null && !country.AllowsShipping)
{
    _notificationService.ErrorNotification(
        $"We don't ship to {country.Name}. Please choose another address.");
    return RedirectToRoute("CheckoutShippingAddress");
}

Type guard

async Task<bool> CountryAllowsShippingAsync(ICountryService svc, Address addr)
{
    var c = await svc.GetCountryByAddressAsync(addr);
    return c == null || c.AllowsShipping;
}

Try / catch

try
{
    var result = await _orderProcessingService.PlaceOrderAsync(processPaymentRequest);
}
catch (NopException ex) when (ex.Message.Contains("is not allowed for shipping"))
{
    _notificationService.ErrorNotification(ex.Message);
    return RedirectToRoute("CheckoutShippingAddress");
}

Prevention

When it happens

Trigger: The customer's shipping address country is marked as 'not allowed for shipping' in Configuration > Countries. The country record was disabled for shipping after the customer selected their address but before order completion.

Common situations: Admin disabled shipping to a country (e.g. due to logistics constraints) but existing customer addresses still reference it. A newly created country record defaults to AllowsShipping=false and wasn't updated. International expansion where the new country wasn't enabled for shipping. A test/staging environment with all countries' shipping disabled.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/4c83deb337b7b9d6. Report an issue: GitHub.