تابع ووکامرسی wc_get_wildcard_postcodes دریافت محدوده کد پستی
تابع ووکامرسی wc_get_wildcard_postcodes – دریافت محدوده کد پستی با توجه کد و کشور
Syntax – سینتکس
(string[]) wc_get_wildcard_postcodes( (string) $postcode, (string) $country = '' );
Parameters – پارامتر ها (2)
- 1- $postcode (string)
- 2- $country (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_wildcard_postcodes' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; } // The postcode. $postcode = ''; // to format postcode for matching. $country = ''; // NOTICE! Understand what this does before running. $result = wc_get_wildcard_postcodes($postcode, $country);
Defined – محل تعریف
/includes/wc-core-functions.php
function wc_get_wildcard_postcodes( $postcode, $country = '' ) { $formatted_postcode = wc_format_postcode( $postcode, $country ); $length = function_exists( 'mb_strlen' ) ? mb_strlen( $formatted_postcode ) : strlen( $formatted_postcode ); $postcodes = array( $postcode, $formatted_postcode, $formatted_postcode . '*', ); for ( $i = 0; $i < $length; $i ++ ) { $postcodes[] = ( function_exists( 'mb_substr' ) ? mb_substr( $formatted_postcode, 0, ( $i + 1 ) * -1 ) : substr( $formatted_postcode, 0, ( $i + 1 ) * -1 ) ) . '*'; } return $postcodes; }
versions – نسخه ها
از نسخه : 2.6.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر