RY WC City Select Action/Filter 列表

Filter

  • ry_wc_city_select_cities:新增鄉鎮市列表。
    1. 所有的鄉鎮市列表

你可以在佈景主題的 function.php 檔案當中設定你自己的鄉鎮市列表,大致上程式碼如下

add_filter( 'ry_wc_city_select_cities', 'my_cities' );
/**
 * Replace XX with the country code. Instead of YYY, ZZZ use actual state codes.
 * The City list can list of city name with postcode or just city name.
 */
function my_cities( $cities ) {
    $cities['XX'] = array(
        'YYY' => array( // city name with postcoe
            ['City', 100],
            ['Another City', 101]
        ),
        'ZZZ' => array( // just city name
            'City 3',
            'City 4'
        )
    );
    return $cities;
}