Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Marketplace › Can Postal Codes and Zip Codes use wild cards?
- This topic has 2 replies, 2 voices, and was last updated 5 years, 8 months ago by Craig.
- AuthorPosts
- March 22, 2019 at 7:04 am #53937CraigParticipant
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 VAttachments:
You must be logged in to view attached files. - March 23, 2019 at 1:07 pm #54204WCFM ForumMember
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
- March 23, 2019 at 5:04 pm #54229CraigParticipant
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.
- AuthorPosts
- The topic ‘Can Postal Codes and Zip Codes use wild cards?’ is closed to new replies.