Automattic\WooCommerce\Internal\Admin\Onboarding
OnboardingThemes::get_price_from_string()
Get puchasable theme by slug.
Method of the class: OnboardingThemes{}
No Hooks.
Return
float|null
.
Usage
$result = OnboardingThemes::get_price_from_string( $price_string );
- $price_string(string) (required)
- string of price.
OnboardingThemes::get_price_from_string() OnboardingThemes::get price from string code WC 8.7.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; }