WC_Admin_Setup_Wizard::wc_setup_shipping │ public │ WC 1.0
Устарела с версии 4.6.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.
Shipping.
Метод класса: WC_Admin_Setup_Wizard{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WC_Admin_Setup_Wizard = new WC_Admin_Setup_Wizard(); $WC_Admin_Setup_Wizard->wc_setup_shipping();
Список изменений
| Устарела с | 4.6.0 |
Код WC_Admin_Setup_Wizard::wc_setup_shipping() WC Admin Setup Wizard::wc setup shipping WC 10.3.4
<?php
public function wc_setup_shipping() {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$country_code = WC()->countries->get_base_country();
$country_name = WC()->countries->countries[ $country_code ];
$prefixed_country_name = WC()->countries->estimated_for_prefix( $country_code ) . $country_name;
$currency_code = get_woocommerce_currency();
$existing_zones = WC_Shipping_Zones::get_zones();
$intro_text = '';
if ( empty( $existing_zones ) ) {
$intro_text = sprintf(
/* translators: %s: country name including the 'the' prefix if needed */
__( "We've created two Shipping Zones - for %s and for the rest of the world. Below you can set Flat Rate shipping costs for these Zones or offer Free Shipping.", 'woocommerce' ),
$prefixed_country_name
);
}
$is_wcs_labels_supported = $this->is_wcs_shipping_labels_supported_country( $country_code );
$is_shipstation_supported = $this->is_shipstation_supported_country( $country_code );
?>
<h1><?php esc_html_e( 'Shipping', 'woocommerce' ); ?></h1>
<?php if ( $intro_text ) : ?>
<p><?php echo wp_kses_post( $intro_text ); ?></p>
<?php endif; ?>
<form method="post">
<?php if ( $is_wcs_labels_supported || $is_shipstation_supported ) : ?>
<ul class="wc-setup-shipping-recommended">
<?php
if ( $is_wcs_labels_supported ) :
$this->display_recommended_item(
array(
'type' => 'woocommerce_services',
'title' => __( 'Did you know you can print shipping labels at home?', 'woocommerce' ),
'description' => __( 'Use WooCommerce Shipping (powered by WooCommerce Services & Jetpack) to save time at the post office by printing your shipping labels at home.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-woocommerce-services-icon.png',
'img_alt' => __( 'WooCommerce Services icon', 'woocommerce' ),
'plugins' => $this->get_wcs_requisite_plugins(),
)
);
elseif ( $is_shipstation_supported ) :
$this->display_recommended_item(
array(
'type' => 'shipstation',
'title' => __( 'Did you know you can print shipping labels at home?', 'woocommerce' ),
'description' => __( 'We recommend using ShipStation to save time at the post office by printing your shipping labels at home. Try ShipStation free for 30 days.', 'woocommerce' ),
'img_url' => WC()->plugin_url() . '/assets/images/obw-shipstation-icon.png',
'img_alt' => __( 'ShipStation icon', 'woocommerce' ),
'plugins' => array(
array(
'name' => __( 'ShipStation', 'woocommerce' ),
'slug' => 'woocommerce-shipstation-integration',
),
),
)
);
endif;
?>
</ul>
<?php endif; ?>
<?php if ( empty( $existing_zones ) ) : ?>
<ul class="wc-wizard-services shipping">
<li class="wc-wizard-service-item">
<div class="wc-wizard-service-name">
<p><?php echo esc_html_e( 'Shipping Zone', 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-service-description">
<p><?php echo esc_html_e( 'Shipping Method', 'woocommerce' ); ?></p>
</div>
</li>
<li class="wc-wizard-service-item">
<div class="wc-wizard-service-name">
<p><?php echo esc_html( $country_name ); ?></p>
</div>
<div class="wc-wizard-service-description">
<?php $this->shipping_method_selection_form( $country_code, $currency_code, 'shipping_zones[domestic]' ); ?>
</div>
<div class="wc-wizard-service-enable">
<span class="wc-wizard-service-toggle">
<input id="shipping_zones[domestic][enabled]" type="checkbox" name="shipping_zones[domestic][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" data-plugins="true" />
<label for="shipping_zones[domestic][enabled]">
</span>
</div>
</li>
<li class="wc-wizard-service-item">
<div class="wc-wizard-service-name">
<p><?php echo esc_html_e( 'Locations not covered by your other zones', 'woocommerce' ); ?></p>
</div>
<div class="wc-wizard-service-description">
<?php $this->shipping_method_selection_form( $country_code, $currency_code, 'shipping_zones[intl]' ); ?>
</div>
<div class="wc-wizard-service-enable">
<span class="wc-wizard-service-toggle">
<input id="shipping_zones[intl][enabled]" type="checkbox" name="shipping_zones[intl][enabled]" value="yes" checked="checked" class="wc-wizard-shipping-method-enable" data-plugins="true" />
<label for="shipping_zones[intl][enabled]">
</span>
</div>
</li>
<li class="wc-wizard-service-info">
<p>
<?php
printf(
wp_kses(
/* translators: %1$s: live rates tooltip text, %2$s: shipping extensions URL */
__( 'If you\'d like to offer <span class="help_tip" data-tip="%1$s">live rates</span> from a specific carrier (e.g. UPS) you can find a variety of extensions available for WooCommerce <a href="%2$s" target="_blank">here</a>.', 'woocommerce' ),
array(
'span' => array(
'class' => array(),
'data-tip' => array(),
),
'a' => array(
'href' => array(),
'target' => array(),
),
)
),
esc_attr__( 'A live rate is the exact cost to ship an order, quoted directly from the shipping carrier.', 'woocommerce' ),
'https://woocommerce.com/product-category/woocommerce-extensions/shipping-methods/shipping-carriers/'
);
?>
</p>
</li>
</ul>
<?php endif; ?>
<div class="wc-setup-shipping-units">
<p>
<?php
echo wp_kses(
sprintf(
/* translators: %1$s: weight unit dropdown, %2$s: dimension unit dropdown */
esc_html__( 'We\'ll use %1$s for product weight and %2$s for product dimensions.', 'woocommerce' ),
$this->get_product_weight_selection(),
$this->get_product_dimension_selection()
),
array(
'span' => array(
'class' => array(),
),
'select' => array(
'id' => array(),
'name' => array(),
'class' => array(),
),
'option' => array(
'value' => array(),
'selected' => array(),
),
)
);
?>
</p>
</div>
<p class="wc-setup-actions step">
<?php $this->plugin_install_info(); ?>
<button class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?>
</p>
</form>
<?php
}