Я устанавливаю зоны доставки со списком почтовых индексов, которые я бы хотел, чтобы магазин доставлял.В зоне доставки woocommerce я добавил 72 почтовых индекса.Я добавил функцию в functions.php для итерации зон, но при выполнении кода ничего не отправляется.Должно быть, я сделал что-то не так.Пожалуйста, помогите.
Here is the code in functions.php:
function delivery_zone(){
$delivery_zones = WC_Shipping_Zones::get_zones();
foreach ((array) $delivery_zones as $key => $the_zone ) {
$count = count($the_zone['zone_locations']);
for($i=1;$i<=$count;$i++){
$the_zone_code = $the_zone['zone_locations'][$i]->code;
return $the_zone_code;
}
}
}
add_shortcode( 'list_shipping_zones', 'delivery_zone' );
#Then in my footer.php
$postal_code = do_shortcode("[list_shipping_zones]");
But the results is only the very first postcode