Automattic\WooCommerce\Internal\Admin\Onboarding

OnboardingThemes::get_paid_theme_by_slug()public staticWC 1.0

Get puchasable theme by slug.

Method of the class: OnboardingThemes{}

No Hooks.

Return

Array|null.

Usage

$result = OnboardingThemes::get_paid_theme_by_slug( $slug );
$slug(string) (required)
from theme.

OnboardingThemes::get_paid_theme_by_slug() code WC 8.7.0

public static function get_paid_theme_by_slug( $slug ) {
	$themes    = self::get_themes();
	$theme_key = array_search( $slug, array_column( $themes, 'slug' ), true );
	$theme     = false !== $theme_key ? $themes[ $theme_key ] : null;
	if ( $theme && isset( $theme['id'] ) && isset( $theme['price'] ) ) {
		$price = self::get_price_from_string( $theme['price'] );
		if ( $price && $price > 0 ) {
			return $themes[ $theme_key ];
		}
	}
	return null;
}