Automattic\WooCommerce\Internal\Admin\Onboarding
OnboardingThemes::get_price_from_string()
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() OnboardingThemes::get price from string WC 7.3.0
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; }