Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › Shipping Zones postal codes issue \"are dependant on \"space\" between the letters\"
- This topic has 1 reply, 2 voices, and was last updated 5 years, 7 months ago by WCFM Forum.
- AuthorPosts
- April 15, 2019 at 6:36 am #57824CraigParticipant
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. - April 16, 2019 at 5:05 am #58075WCFM ForumMember
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
- AuthorPosts
- The topic ‘Shipping Zones postal codes issue \"are dependant on \"space\" between the letters\"’ is closed to new replies.