Automattic\WooCommerce\StoreApi\Utilities
LocalPickupUtils::get_local_pickup_settings()
Gets the local pickup location settings.
Метод класса: LocalPickupUtils{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = LocalPickupUtils::get_local_pickup_settings( $context );
- $context(строка)
- The context for the settings.
По умолчанию: 'view'
Код LocalPickupUtils::get_local_pickup_settings() LocalPickupUtils::get local pickup settings WC 9.6.0
public static function get_local_pickup_settings( $context = 'view' ) { $pickup_location_settings = get_option( 'woocommerce_pickup_location_settings', [ 'enabled' => 'no', 'title' => __( 'Pickup', 'woocommerce' ), ] ); if ( empty( $pickup_location_settings['title'] ) ) { $pickup_location_settings['title'] = __( 'Pickup', 'woocommerce' ); } if ( empty( $pickup_location_settings['enabled'] ) ) { $pickup_location_settings['enabled'] = 'no'; } // Return settings as is if we're editing them. if ( 'edit' === $context ) { return $pickup_location_settings; } // All consumers of this turn it into a bool eventually. Doing it here removes the need for that. $pickup_location_settings['enabled'] = wc_string_to_bool( $pickup_location_settings['enabled'] ); $pickup_location_settings['title'] = wc_clean( $pickup_location_settings['title'] ); return $pickup_location_settings; }