Automattic\WooCommerce\Blocks\Shipping
ShippingController::is_legacy_local_pickup_active
Check if legacy local pickup is activated in any of the shipping zones or in the Rest of the World zone.
Метод класса: ShippingController{}
Хуков нет.
Возвращает
true|false.
Использование
$result = ShippingController::is_legacy_local_pickup_active();
Список изменений
| С версии 8.8.0 | Введена. |
Код ShippingController::is_legacy_local_pickup_active() ShippingController::is legacy local pickup active WC 11.0.1
public static function is_legacy_local_pickup_active() {
$rest_of_the_world = \WC_Shipping_Zones::get_zone_by( 'zone_id', 0 );
$shipping_zones = \WC_Shipping_Zones::get_zones();
$rest_of_the_world_data = $rest_of_the_world->get_data();
$rest_of_the_world_data['shipping_methods'] = $rest_of_the_world->get_shipping_methods();
array_unshift( $shipping_zones, $rest_of_the_world_data );
foreach ( $shipping_zones as $zone ) {
foreach ( $zone['shipping_methods'] as $method ) {
if ( 'local_pickup' === $method->id && $method->is_enabled() ) {
return true;
}
}
}
return false;
}