Shipping Zones postal codes issue \"are dependant on \"space\" between the letters\"

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Marketplace (WooCommerce Multivendor Marketplace) Shipping Zones postal codes issue \"are dependant on \"space\" between the letters\"

Viewing 1 reply thread
  • Author
    Posts
    • #57824
      Craig
      Participant

      Please make the postal code setting NOT be dependant on the space in the postal code.
      Many people use the postal codes with or without the space so this is causing many errors.
      See Screenshots for this example.

      Can you change that in your plugin? Or does this need to be done through our theme?

      In a different multi-vendor plugin something like this needed to be added:

      WooCommerce puts that space in there on the front end forms. In that same code block replace the first two lines to this

      // clean both codes before doing anything to them
      $customer_postcode = strtolower( str_replace( ‘ ‘, ”, $customer_postcode ) );
      $rate_postcode = strtolower( str_replace( ‘ ‘, ”, $rate_postcode ) );

      do i need to add this to my theme….or do you need to add this to your plugin?

      Attachments:
      You must be logged in to view attached files.
    • #58075
      WCFM Forum
      Member

      Hi,

      Well, I don’t think you need to remove this in-between “space” for any purpose.

      Between, using WCFM shipping it’s possible to validate ZIP code only by it’s prefix as well.

      e.g. in your screenshot you have entered ZIP Code “V9R 4G3”. Now, it’s possible to validate all zip codes start with “V9R”.

      In shipping setting do not set full zip codes, just set “V9R” and add this code to child theme’s functions.php –

      add_filter( 'wcfmmp_shipping_postcode_check_rule', function( $is_allow, $destination_postcode, $postcode_array ) {
      	if( !empty( $postcode_array ) ) {
      		foreach( $postcode_array as $postcode ) {
      			if( substr( $destination_postcode, 0, strlen( $postcode ) ) === $postcode ) $is_allow = true;
      		}
      	}
      	return $is_allow;
      }, 50, 3 );

      Now all zip codes starts with “V9R” will be considered as allowed/valid zip code.

      Thank You

Viewing 1 reply thread
  • The topic ‘Shipping Zones postal codes issue \"are dependant on \"space\" between the letters\"’ is closed to new replies.