WordPress.org

Forums

Jigoshop
[resolved] Postcode (billing) is not a valid postcode/ZIP. (20 posts)

  1. normski
    Member
    Posted 1 year ago #

    I have entered a valid UK postcode but get the message: "Postcode (billing) is not a valid postcode/ZIP."

    Any advice gratefully received.

    Norman

    https://wordpress.org/plugins/jigoshop/

  2. normski
    Member
    Posted 1 year ago #

    I notice that another user raised the same issue and it is marked as 'resolved'. But I am still experiencing the problem withy UK postcodes.

    Please advise

    Norman

  3. Ragnar Karlsson
    Member
    Posted 1 year ago #

    I am also seeing this behaviour with UK post codes, both with a space in the post code and not.

  4. Ragnar Karlsson
    Member
    Posted 1 year ago #

    Further to this I have checked, Jigoshop setting to validate post code is disabled but clearly javascript is still doing so.

  5. Ragnar Karlsson
    Member
    Posted 1 year ago #

    Normski, I believe I have found the issue.

    jigoshop/classes/jigoshop_validation.class.php

    There is a function as follows:

    /**
    	 * Checks for a valid postcode for a country
    	 *
    	 * @param   string  postcode
    	 * @param  string  country
    	 * @return  boolean
    	 */
    	public static function is_postcode($postcode, $country)
    	{
    		if (strlen(trim(preg_replace('/[\s\-A-Za-z0-9]/', '', $postcode))) > 0) {
    			return false;
    		}
    
    		$country = strtoupper(trim($country));
    		$postcode = strtoupper(trim($postcode));
    
    		if (!isset(self::$postcodes[$country])) {
    			return false;
    		}
    
    		if (Jigoshop_Base::get_options()->get_option('jigoshop_enable_postcode_validating') == 'yes') {
    			$regex = '/'.self::$postcodes[$country].'/';
    			jigoshop_log("VALIDATE POSTCODE: country = ".$country." & regex = ".$regex);
    
    			switch ($country) {
    				case 'GB':
    					return self::is_GB_postcode($postcode);
    				default:
    					$match = preg_match($regex, $postcode);
    					if ($match !== 1) {
    						return false;
    					}
    			}
    		}
    
    		return true;
    	}

    Specifically the line

    case 'GB':

    Caused me to look further up, adjusting the line

    'UK' => '^(GIR|[A-Z]\d[A-Z\d]??|[A-Z]{2}\d[A-Z\d]??)[ ]??(\d[A-Z]{2})$',

    From UK to GB fixes the issue for me.

    Jigoshop, strangely this only occurs on my live environment and not test.

  6. normski
    Member
    Posted 1 year ago #

    Many thanks Ragnar.

    That works for me too.

    I wonder if you can help with another matter. Is there a way of editing or changing the fields on the billing details/order form?

    All hte best

    Normski

  7. Ragnar Karlsson
    Member
    Posted 1 year ago #

    My suspicion is that there is an underlying issue with this though, my test site doesn't need this fix on 1.10.5 whilst the live site does.

    Jigoshop team - can you replicate?

    I use the Checkout Fields Manager currently: https://www.jigoshop.com/product/checkout-fields-manager/

  8. Jigoshop Support - Paul
    Jigoshop Support Rep
    Plugin Author

    Posted 1 year ago #

    we are looking into it now...

  9. Ragnar Karlsson
    Member
    Posted 1 year ago #

    Thanks Paul much appreciated.

  10. Jigoshop Support - Amadeusz
    Member
    Posted 1 year ago #

    Can I get the postcode you are having problems with? I tested it on a few things and moreover the code for validationg was not changed. The only thing is adding frontend validation in JavaScript (to speed up validation).

  11. Ragnar Karlsson
    Member
    Posted 1 year ago #

    I tried using PL9 7YB (pinched direct from Royal Mail website)

    Please note that the javascript validation doesn't appear to be the issue I'm facing but rather jigoshop_validation.class.php

    I can send system info to support@jigoshop.com if that is of help?

  12. Jigoshop Support - Amadeusz
    Member
    Posted 1 year ago #

    OK, the problem exists - will be fixed in 1.10.6

  13. Ragnar Karlsson
    Member
    Posted 1 year ago #

    Great, thanks folks

  14. normski
    Member
    Posted 1 year ago #

    Thank you Ragnar and Amadeusz.

  15. andytoop
    Member
    Posted 12 months ago #

    Great that it will be fixed, but what about all the folks that can't order on my shop at the moment? when will 1.10.6 be available?

    where do I find: jigoshop/classes/jigoshop_validation.class.php as posted up on Ragnar's post

    Andy

  16. andytoop
    Member
    Posted 12 months ago #

    found it ta.

  17. thelandlord
    Member
    Posted 6 months ago #

    Hi
    I'm having the same issues, but with international post codes - Ireland and Israel in particular.
    I believe Ireland doesn't use post codes unless it's Dublin.

    One customer in Israel just emailed to say his post code "6936050" is not valid when trying to place an order.

    I have corrected the 'postcode required' in ....checkout.php = false (from true).
    So, if you leave it blank, it works, but if you enter a post code, using the Israel example, it says post code invalid still.

    Can this be fixed?

  18. Jigoshop Support - Michael
    Member
    Plugin Author

    Posted 5 months ago #

    @thelandlord - I'm reporting this to development.

  19. Jigoshop Support - Michael
    Member
    Plugin Author

    Posted 5 months ago #

    @thelandlord - We will provide a fix in our next update.

  20. thelandlord
    Member
    Posted 5 months ago #

    Thank you for the support Michael, look forward to it.

    While we are on the subject we have another 'Premium Shipping' issue we encounter every so often; postage is not applied to international orders, in particular but not exclusively Israel, Ireland and Lithuania.

    Perhaps it could be part of the same problem above?

    Have others had this problem? We are based in UK (England) if it makes any difference.

    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jigoshop
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.