Can Postal Codes and Zip Codes use wild cards?

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 WC Marketplace Can Postal Codes and Zip Codes use wild cards?

Tagged: , ,

Viewing 2 reply threads
  • Author
    Posts
    • #53937
      Craig
      Participant

      Can you confirm if “wild cards” can be used for postal codes in the shipping settings?

      For example:

      Single code
      Example postcode: V9R 5S5
      This will match only the post code V9R 5S5.

      Range code
      – you can use a – (hyphen) to set up a range of post codes
      Example postcode range: V9R-V9X
      This will match every post code in the range starting with V9R to and V9X
      or you can do this V9R*-V9X*
      or you can do this V9R*,V9S*,V9T*,V9V*,V9X*

      Wildcard codes
      – you can use a * (asterisk) to provide a wild card match
      Example wildcard postcode: V9* or V*
      This will match every post code starting with V9 or V

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

      Hi,

      Yeah possible. Use this code snippet for the purpose –

      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 );

      Thank You

    • #54229
      Craig
      Participant

      Thanks for this information! I will pass this on to my team.

      Will you kindly add this to your core code as I’m sure many other marketplaces would find this very useful.

Viewing 2 reply threads
  • The topic ‘Can Postal Codes and Zip Codes use wild cards?’ is closed to new replies.