Automattic\WooCommerce\Internal\Admin\Onboarding

OnboardingThemes::get_price_from_string()private staticWC 1.0

Get puchasable theme by slug.

{} Это метод класса: OnboardingThemes{}

Хуков нет.

Возвращает

float|null.

Использование

$result = OnboardingThemes::get_price_from_string( $price_string );
$price_string(строка) (обязательный)
string of price.

Код OnboardingThemes::get_price_from_string() WC 6.6.1

private static function get_price_from_string( $price_string ) {
	$price_match = null;
	// Parse price from string as it includes the currency symbol.
	preg_match( '/\\d+\.\d{2}\s*/', $price_string, $price_match );
	if ( count( $price_match ) > 0 ) {
		return (float) $price_match[0];
	}
	return null;
}