Automattic\WooCommerce\Blocks\Utils
CartCheckoutUtils::shipping_methods_exist()
Returns true if shipping methods exist in the store. Excludes local pickup and only counts enabled shipping methods.
Метод класса: CartCheckoutUtils{}
Хуков нет.
Возвращает
true|false
. true if shipping methods exist.
Использование
$result = CartCheckoutUtils::shipping_methods_exist();
Код CartCheckoutUtils::shipping_methods_exist() CartCheckoutUtils::shipping methods exist WC 9.8.5
public static function shipping_methods_exist() { // Local pickup is included with legacy shipping methods since they do not support shipping zones. $local_pickup_count = count( array_filter( WC()->shipping()->get_shipping_methods(), function ( $method ) { return isset( $method->enabled ) && 'yes' === $method->enabled && ! $method->supports( 'shipping-zones' ) && $method->supports( 'local-pickup' ); } ) ); $shipping_methods_count = wc_get_shipping_method_count( true, true ) - $local_pickup_count; return $shipping_methods_count > 0; }