id = 'connect'; $this->label = _x( 'WooCommerce Shipping', 'The WooCommerce Shipping brandname', 'woocommerce-services' ); $this->continents = new WC_Connect_Continents(); $this->api_client = $api_client; $this->service_schemas_store = $service_schemas_store; add_filter( 'woocommerce_get_sections_shipping', array( $this, 'get_sections' ), 30 ); add_action( 'woocommerce_settings_shipping', array( $this, 'output_settings_screen' ), 5 ); } /** * Get sections. * * @return array */ public function get_sections( $shipping_tabs ) { // If WC Shipping is active, it will register its page instead. if ( WC_Connect_Loader::is_wc_shipping_activated() ) { return $shipping_tabs; } if ( ! is_array( $shipping_tabs ) ) { $shipping_tabs = array(); } $shipping_tabs['woocommerce-services-settings'] = __( 'WooCommerce Shipping', 'woocommerce-services' ); return $shipping_tabs; } /** * Output the settings. */ public function output_settings_screen() { global $current_section; if ( 'woocommerce-services-settings' !== $current_section ) { return; } add_filter( 'woocommerce_get_settings_shipping', '__return_empty_array' ); $this->output_shipping_settings_screen(); } /** * Localizes the bootstrap, enqueues the script and styles for the settings page */ public function output_shipping_settings_screen() { // hiding the save button because the react container has its own. global $hide_save_button; $hide_save_button = true; if ( WC_Connect_Jetpack::is_offline_mode() ) { if ( WC_Connect_Jetpack::is_connected() ) { $message = __( 'Note: Your site is connected but WooCommerce Tax is configured to work in offline mode. Please disable offline mode.', 'woocommerce-services' ); } else { $message = __( 'Note: WooCommerce Tax is configured to work in offline mode. This site will not be able to obtain payment methods from WooCommerce Tax production servers.', 'woocommerce-services' ); } ?>