Hi all, Was looking at charging a fixed shipping rate based off of a customer's shipping address's post(zip) code. I found the option to do this in the Shipping.ByWeight module but it appears you can only specify 1 post code at a time which will result in hundreds of records being required to be created (and maintained) to cover all the post codes we're delivering to.
Is there a way to specify multiple post codes? I tried a csv eg (2000,2001,2002,2003,2004) and a few other alternatives but couldn't get it to work.
Anyone had any luck with this using either a included shipping module or 3rd party plugin?
The Shipping By Total plugin can match multiple zip codes per record since version 1.14/1.15 (nopCommerce 3.20).
From the 1.14 list of changes: Added support for multiple ZIP / postal codes per ShippingByTotal record. Store owners will be able to input ZIP / postal codes in multiple formats: -single entry (12345) -multiple entry (12345, 12346) -wildcard (S4? ???) -numeric range (10000:30000) -combinations of the above (11111, 100??, 11111:22222, 33333)
The Shipping By Total plugin can match multiple zip codes per record since version 1.14/1.15 (nopCommerce 3.20).
From the 1.14 list of changes: Added support for multiple ZIP / postal codes per ShippingByTotal record. Store owners will be able to input ZIP / postal codes in multiple formats: -single entry (12345) -multiple entry (12345, 12346) -wildcard (S4? ???) -numeric range (10000:30000) -combinations of the above (11111, 100??, 11111:22222, 33333)
Hello! I had a client that also needed to have different costs in respect to the shipping address of the customer and I saw that the plugin's logic didn't support more than one postal codes so I updated the Shipping.FixedByWeightByTotal plug-in to do just that:
(Version 4.30, but probably applies to the previous ones as I don't see the plugin changed a lot over the years)
Find the ShippingByWeightByTotalService.cs (Plugins File->Nop.Plugin.Shpping.fixedByWeightByTotal).
Change the //filter by Zip to:
//filter by zip var matchedByZip = string.IsNullOrEmpty(zip) ? matchedByStateProvince : matchedByStateProvince.Where(r => string.IsNullOrEmpty(r.Zip) || r.Zip.Equals(MatchZip(r.Zip, zip)));
And add this method:
//: MatchZip is a method I created so that we can input a lot of Zipcodes and split them with various ways. //We can split zipcodes with ";", eg: 18540; 18541; 18542 //We can use ranges with "-", eg: 18540-18542 //We can use a combination of those! eg: 18540-18542; 16724; 16789; 17823-17832; public string MatchZip(string rulesZip, string userZip) { var trimmedZip = rulesZip.Trim(' '); string[] zips = trimmedZip.Split(';');
foreach (var zip in zips) { if (zip.Equals(userZip)) return rulesZip;
if (zip.Contains("-")) { string[] rangeZips = zip.Split('-');