NopCommerce 4.20: Limit shipping to specific state

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 anos atrás
I have some products that I only want allowed to be shipped to a single state.

I went to Configuration->Countries, added a new "United States", then put it only the state I wanted allowed.

This had the intended effect; however, not only that state can be selected for billing, which I do not want. I want all states available for billing. How can I achieve this?

I have Shipping Director, and I tried adding the following rules:

ErrorExit  Missing Country State Zip  ShippingAddress.Country = null or ShippingAddress.ZipPostalCode = null or ("US,CA".Contains(ShippingAddress.Country.TwoLetterIsoCode) and ShippingAddress.StateProvince = null)

ErrorExit  Only Ship to WA State  ShippingAddress.StateProvince.Abbreviation != "WA"

But this seemed to not have any effect on the checkout process.
3 anos atrás
In standard nopCommerce, although Countries have properties for
  Allows billing
  Allows shipping
States do not.  As you noticed, only having one state linked to the country means the limitation applies to both shipping and billing addresses.

You've already contacted us at nopTools for support, but for everyone else's benefit ;) ...  When using Shipping Director, it must be the only Active shipping provider plugin.  You can call another plugin from Shipping Director.  So, for example, the ErrorExit rule expression can check the state

  10
  ErrorExit
  Product 123 can only ship to NY
  Items.Any(Product.Sku = "123") and State != "NY"
  "Sorry, we can't 123 outside of NY"

Then, follow your ErrorExit rules with Option rules - e.g.

  20
  Option
  FedEx
  true
  Shipping.FedEx

Note that if you have many restricted products, we recommend that you create an Unpublished Category for them, and then your ErrorExit Expression would be:

  Items.Any(Product.HasCategory("Shipping to NY Only")) and State != "NY"
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.