Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentsExtensionSuggestions::is_merchant_selling_offline
Based on the WC onboarding profile, determine if the merchant is selling offline.
If the user skipped the profiler (no data points provided), we assume they are NOT selling offline.
Method of the class: PaymentsExtensionSuggestions{}
No Hooks.
Returns
true|false. True if the merchant is selling offline, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->is_merchant_selling_offline(): bool;
PaymentsExtensionSuggestions::is_merchant_selling_offline() PaymentsExtensionSuggestions::is merchant selling offline code WC 10.7.0
private function is_merchant_selling_offline(): bool {
/*
* We consider a merchant to be selling offline if:
* - The profiler was NOT skipped (data points provided).
* AND
* - The merchant answered 'Which one of these best describes you?' with 'I’m already selling' AND:
* - Answered the 'Are you selling online?' question with either:
* - 'No, I’m selling offline'.
* OR
* - 'I’m selling both online and offline'.
*
* @see plugins/woocommerce/client/admin/client/core-profiler/pages/UserProfile.tsx for the values.
*/
$onboarding_profile = get_option( OnboardingProfile::DATA_OPTION, array() );
if (
isset( $onboarding_profile['business_choice'] ) &&
(
'im_already_selling' === $onboarding_profile['business_choice'] &&
(
isset( $onboarding_profile['selling_online_answer'] ) &&
(
'no_im_selling_offline' === $onboarding_profile['selling_online_answer'] ||
'im_selling_both_online_and_offline' === $onboarding_profile['selling_online_answer']
)
)
)
) {
return true;
}
return false;
}