Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentExtensionSuggestions::is_merchant_selling_online()
Based on the WC onboarding profile, determine if the merchant is selling online.
If the user skipped the profiler (no data points provided), we assume they are selling online.
Method of the class: PaymentExtensionSuggestions{}
No Hooks.
Return
true|false
. True if the merchant is selling online, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->is_merchant_selling_online(): bool;
PaymentExtensionSuggestions::is_merchant_selling_online() PaymentExtensionSuggestions::is merchant selling online code WC 9.6.0
private function is_merchant_selling_online(): bool { /* * We consider a merchant to be selling online if: * - The profiler was skipped (no data points provided). * OR * - The merchant answered 'Which one of these best describes you?' with 'I’m already selling' AND: * - Didn't answer to the 'Are you selling online?' question. * OR * - Answered the 'Are you selling online?' question with either: * - 'Yes, I’m selling online'. * 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'] ) || ( 'yes_im_selling_online' === $onboarding_profile['selling_online_answer'] || 'im_selling_both_online_and_offline' === $onboarding_profile['selling_online_answer'] ) ) ) ) { return false; } return true; }