Shipping Settings: Fix shipping zones tour copy (#41015)

This commit is contained in:
Paul Sealock 2023-10-31 16:42:45 +13:00 committed by paul sealock
parent ff1d69efb1
commit b82b3e452c
3 changed files with 46 additions and 10 deletions

View File

@ -122,12 +122,12 @@ const spotlitElementsSelectors: Array< NonEmptySelectorArray > = [
// top left = table header cell for sort handles
'th.wc-shipping-zone-sort',
// bottom right = worldwide region cell
'tr.wc-shipping-zone-worldwide > td.wc-shipping-zone-region',
'tfoot.wc-shipping-zone-worldwide tr > td.wc-shipping-zone-region',
],
[
// selectors for rightmost column (shipping methods)
'th.wc-shipping-zone-methods',
'tr.wc-shipping-zone-worldwide > td.wc-shipping-zone-methods',
'tfoot.wc-shipping-zone-worldwide tr > td.wc-shipping-zone-methods',
],
];
@ -251,14 +251,21 @@ export const ShippingTour: React.FC< {
<>
<span>
{ __(
'We added a few shipping zones for you based on your location, but you can manage them at any time.',
"Specify the areas you'd like to ship to! We added a few shipping zones for you based on your location, but you can manage them at any time. Give each zone a name, select the region(s) you'd like to include, and add available shipping methods. Your shipping regions can be as specific as a zip code, or as broad as a country.",
'woocommerce'
) }
</span>
<br />
<span>
{ __(
'A shipping zone is a geographic area where a certain set of shipping methods are offered.',
'Your customers will only see the methods available to their region, and can only match one zone.',
'woocommerce'
) }
</span>
<br />
<span>
{ __(
'We\'ve added some shipping zones to get you started — you can add or edit them by clicking on "Edit | Delete".',
'woocommerce'
) }
</span>
@ -275,9 +282,22 @@ export const ShippingTour: React.FC< {
name: 'shipping-methods',
heading: __( 'Shipping methods', 'woocommerce' ),
descriptions: {
desktop: __(
'We defaulted to some recommended shipping methods based on your store location, but you can manage them at any time within each shipping zone settings.',
'woocommerce'
desktop: (
<>
<span>
{ __(
"Add one or more shipping methods that you'd like to make available to customers in your zones.",
'woocommerce'
) }
</span>
<br />
<span>
{ __(
'For example, in the default settings we\'ve provided, free shipping is offered to customers in your country. You can edit these or add more shipping methods by clicking on "Edit | Delete".',
'woocommerce'
) }
</span>
</>
),
},
},
@ -323,7 +343,7 @@ export const ShippingTour: React.FC< {
heading: __( 'WooCommerce Shipping', 'woocommerce' ),
descriptions: {
desktop: __(
'Print USPS and DHL labels straight from your WooCommerce dashboard and save on shipping thanks to discounted rates. You can manage WooCommerce Shipping in this section.',
'Print USPS and DHL labels straight from your Woo dashboard and save on shipping thanks to discounted rates. You can manage WooCommerce Shipping in this section.',
'woocommerce'
),
},
@ -341,7 +361,7 @@ export const ShippingTour: React.FC< {
heading: __( 'WooCommerce Shipping', 'woocommerce' ),
descriptions: {
desktop: __(
'If youd like to speed up your process and print your shipping label straight from your WooCommerce dashboard, WooCommerce Shipping may be for you! ',
'If youd like to speed up your process and print your shipping label straight from your Woo dashboard, WooCommerce Shipping may be for you! ',
'woocommerce'
),
},

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Comment: Updating unreleased changes

View File

@ -133,7 +133,19 @@ class Homescreen {
$zone = new \WC_Shipping_Zone();
$zone->set_zone_name( $country_name );
$zone->add_location( $country_code, 'country' );
$zone->add_shipping_method( 'free_shipping' );
// Method creation has no default title, use the REST API to add a title.
$instance_id = $zone->add_shipping_method( 'free_shipping' );
$request = new \WP_REST_Request( 'POST', '/wc/v2/shipping/zones/' . $zone->get_id() . '/methods/' . $instance_id );
$request->set_body_params(
array(
'settings' => array(
'title' => 'Free shipping',
),
)
);
rest_do_request( $request );
update_option( 'woocommerce_admin_created_default_shipping_zones', 'yes' );
Shipping::delete_zone_count_transient();
}