Automattic\WooCommerce\StoreApi\Utilities

LocalPickupUtils::is_local_pickup_enabled()public staticWC 1.0

Checks if WC Blocks local pickup is enabled.

Method of the class: LocalPickupUtils{}

No Hooks.

Return

true|false. True if local pickup is enabled.

Usage

$result = LocalPickupUtils::is_local_pickup_enabled();

LocalPickupUtils::is_local_pickup_enabled() code WC 9.4.2

public static function is_local_pickup_enabled() {
	// Get option directly to avoid early translation function call.
	// See https://github.com/woocommerce/woocommerce/pull/47113.
	$pickup_location_settings = get_option(
		'woocommerce_pickup_location_settings',
		[
			'enabled' => 'no',
		]
	);

	if ( empty( $pickup_location_settings['enabled'] ) ) {
		$pickup_location_settings['enabled'] = 'no';
	}

	return wc_string_to_bool( $pickup_location_settings['enabled'] );
}