WC_Admin_Setup_Wizard::wc_setup_store_setup() │ public │ WC 1.0
Initial "store setup" step. Location, product type, page setup, and tracking opt-in.
Method of the class: WC_Admin_Setup_Wizard{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Admin_Setup_Wizard = new WC_Admin_Setup_Wizard(); $WC_Admin_Setup_Wizard->wc_setup_store_setup();
WC_Admin_Setup_Wizard::wc_setup_store_setup() WC Admin Setup Wizard::wc setup store setup code WC 9.6.0
<?php public function wc_setup_store_setup() { _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); $address = WC()->countries->get_base_address(); $address_2 = WC()->countries->get_base_address_2(); $city = WC()->countries->get_base_city(); $state = WC()->countries->get_base_state(); $country = WC()->countries->get_base_country(); $postcode = WC()->countries->get_base_postcode(); $currency = get_option( 'woocommerce_currency', 'USD' ); $product_type = get_option( 'woocommerce_product_type', 'both' ); $sell_in_person = get_option( 'woocommerce_sell_in_person', 'none_selected' ); if ( empty( $country ) ) { $user_location = WC_Geolocation::geolocate_ip(); $country = $user_location['country']; $state = $user_location['state']; } $locale_info = include WC()->plugin_path() . '/i18n/locale-info.php'; $currency_by_country = wp_list_pluck( $locale_info, 'currency_code' ); ?> <form method="post" class="address-step"> <input type="hidden" name="save_step" value="store_setup" /> <?php wp_nonce_field( 'wc-setup' ); ?> <p class="store-setup"><?php esc_html_e( 'The following wizard will help you configure your store and get you started quickly.', 'woocommerce' ); ?></p> <div class="store-address-container"> <label for="store_country" class="location-prompt"><?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?></label> <select id="store_country" name="store_country" required data-placeholder="<?php esc_attr_e( 'Choose a country / region…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country / Region', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown"> <?php foreach ( WC()->countries->get_countries() as $code => $label ) : ?> <option <?php selected( $code, $country ); ?> value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $label ); ?></option> <?php endforeach; ?> </select> <label class="location-prompt" for="store_address"><?php esc_html_e( 'Address', 'woocommerce' ); ?></label> <input type="text" id="store_address" class="location-input" name="store_address" required value="<?php echo esc_attr( $address ); ?>" /> <label class="location-prompt" for="store_address_2"><?php esc_html_e( 'Address line 2', 'woocommerce' ); ?></label> <input type="text" id="store_address_2" class="location-input" name="store_address_2" value="<?php echo esc_attr( $address_2 ); ?>" /> <div class="city-and-postcode"> <div> <label class="location-prompt" for="store_city"><?php esc_html_e( 'City', 'woocommerce' ); ?></label> <input type="text" id="store_city" class="location-input" name="store_city" required value="<?php echo esc_attr( $city ); ?>" /> </div> <div class="store-state-container hidden"> <label for="store_state" class="location-prompt"> <?php esc_html_e( 'State', 'woocommerce' ); ?> </label> <select id="store_state" name="store_state" data-placeholder="<?php esc_attr_e( 'Choose a state…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'State', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown"></select> </div> <div> <label class="location-prompt" for="store_postcode"><?php esc_html_e( 'Postcode / ZIP', 'woocommerce' ); ?></label> <input type="text" id="store_postcode" class="location-input" name="store_postcode" required value="<?php echo esc_attr( $postcode ); ?>" /> </div> </div> </div> <div class="store-currency-container"> <label class="location-prompt" for="currency_code"> <?php esc_html_e( 'What currency do you accept payments in?', 'woocommerce' ); ?> </label> <select id="currency_code" name="currency_code" required data-placeholder="<?php esc_attr_e( 'Choose a currency…', 'woocommerce' ); ?>" class="location-input wc-enhanced-select dropdown" > <option value=""><?php esc_html_e( 'Choose a currency…', 'woocommerce' ); ?></option> <?php foreach ( get_woocommerce_currencies() as $code => $name ) : ?> <option value="<?php echo esc_attr( $code ); ?>" <?php selected( $currency, $code ); ?>> <?php $symbol = get_woocommerce_currency_symbol( $code ); if ( $symbol === $code ) { /* translators: 1: currency name 2: currency code */ echo esc_html( sprintf( __( '%1$s (%2$s)', 'woocommerce' ), $name, $code ) ); } else { /* translators: 1: currency name 2: currency symbol, 3: currency code */ echo esc_html( sprintf( __( '%1$s (%2$s %3$s)', 'woocommerce' ), $name, get_woocommerce_currency_symbol( $code ), $code ) ); } ?> </option> <?php endforeach; ?> </select> <script type="text/javascript"> var wc_setup_currencies = JSON.parse( decodeURIComponent( '<?php echo rawurlencode( wp_json_encode( $currency_by_country ) ); ?>' ) ); var wc_base_state = "<?php echo esc_js( $state ); ?>"; </script> </div> <div class="product-type-container"> <label class="location-prompt" for="product_type"> <?php esc_html_e( 'What type of products do you plan to sell?', 'woocommerce' ); ?> </label> <select id="product_type" name="product_type" required class="location-input wc-enhanced-select dropdown"> <option value="both" <?php selected( $product_type, 'both' ); ?>><?php esc_html_e( 'I plan to sell both physical and digital products', 'woocommerce' ); ?></option> <option value="physical" <?php selected( $product_type, 'physical' ); ?>><?php esc_html_e( 'I plan to sell physical products', 'woocommerce' ); ?></option> <option value="virtual" <?php selected( $product_type, 'virtual' ); ?>><?php esc_html_e( 'I plan to sell digital products', 'woocommerce' ); ?></option> </select> </div> <div class="sell-in-person-container"> <input type="checkbox" id="woocommerce_sell_in_person" name="sell_in_person" value="yes" <?php checked( $sell_in_person, true ); ?> /> <label class="location-prompt" for="woocommerce_sell_in_person"> <?php esc_html_e( 'I will also be selling products or services in person.', 'woocommerce' ); ?> </label> </div> <input type="checkbox" id="wc_tracker_checkbox" name="wc_tracker_checkbox" value="yes" <?php checked( 'yes', get_option( 'woocommerce_allow_tracking', 'no' ) ); ?> /> <?php $this->tracking_modal(); ?> <p class="wc-setup-actions step"> <button class="button-primary button button-large" value="<?php esc_attr_e( "Let's go!", 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( "Let's go!", 'woocommerce' ); ?></button> </p> </form> <?php }