Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Shipping by Rules for VirtueMart

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

International postcode format 24 Jan 2014 16:36 #1

  • athenacraftsltd
  • athenacraftsltd's Avatar Topic Author
I have a number of rules for different shipping methods and different costs, mostly based on numeric postcodes / zip codes.

I've come across a couple of issues this afternoon that might be worth investigating.

Ireland:
A lot of Ireland (the Republic of Ireland, not Northern Ireland) doesn't use postcodes, but the postcode field is mandatory. I've addressed this by writing a little Javascript to check the selected country is Ireland and fill in the postcode field with "N/A" if it's empty. It also blanks the postcode field if it already has N/A in it and the country isn't Ireland. This is triggered when either the postcode or country fields are changed.

Portugal:
A lot of Portuguese people format their postcode 0000-000. This doesn't seem to register with the plugin when the postcodes in the rule are numeric. I've written a litte Javascript to strip the dash out of the postcode when it's changed, so the field will only contain 0000000. There are a number of other countries that also use dashes in their postcodes.

Hope this is of use to anyone.

International postcode format 27 Jan 2014 13:25 #2

Thank you for your feedback.

The first issue (Ireland not having postal codes, but VM requiring it) is actually a core VirtueMart cart issue that has nothing to do with a shipping plugin.

The second issue (Portugal using dashes after the fourth digit) is a bit trickier. If you need only the firs four digits in the comparisons, you can simply use the ZIP4 variable rather than the full ZIP variable.

Best regards,
Reinhold

International postcode format 27 Jan 2014 13:37 #3

  • athenacraftsltd
  • athenacraftsltd's Avatar Topic Author
Hi Reinhold,

You're quite right about Ireland; I'd spent so long on my specific problems it didn't occur to me that it's unrelated to the plugin. I hope my suggestion is of some use anyway. Unfortunately, in my case I think the Portuguese postcodes required all the digits. My jQuery hack works exactly as I need it to, but it's something you might want to consider.
var $j = jQuery.noConflict();				//avoid conflict with other libraries
$j('#zip_field').change(function () {
	$j('#zip_field').val(zip.replace('-',''));	//remove any dashes in the postcode format; this will allow the shipping method to determine if it needs special attention.
});

[SOLVED] International postcode format 31 Jan 2014 12:31 #4

Problem solved.
  • Page:
  • 1