Shipping Settings: Remove zone method defaults (#40838)
This commit is contained in:
parent
1a0da8a62d
commit
6f460e603a
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
Comment: Fix already implemented behaviour
|
||||
|
|
@ -148,7 +148,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" data-status='{{ data.status }}' class="button button-primary button-large">
|
||||
<button id="btn-ok" data-status='{{ data.status }}' disabled='{{ data.status === "new" ? "disabled" : "" }}' class="button button-primary button-large {{ data.status === 'new' ? 'disabled' : '' }}">
|
||||
<div class="wc-backbone-modal-action-{{ data.status === 'new' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div>
|
||||
<div class="wc-backbone-modal-action-{{ data.status === 'existing' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div>
|
||||
</button>
|
||||
|
|
|
@ -14,7 +14,8 @@ $settings = array(
|
|||
'title' => __( 'Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => __( 'Flat rate', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'placeholder' => __( 'e.g. Standard national', 'woocommerce' ),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'tax_status' => array(
|
||||
|
|
|
@ -92,7 +92,8 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
|||
'title' => __( 'Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => $this->method_title,
|
||||
'default' => '',
|
||||
'placeholder' => __( 'e.g. Free shipping', 'woocommerce' ),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'requires' => array(
|
||||
|
|
|
@ -88,7 +88,8 @@ class WC_Shipping_Local_Pickup extends WC_Shipping_Method {
|
|||
'title' => __( 'Name', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => __( 'Local pickup', 'woocommerce' ),
|
||||
'default' => '',
|
||||
'placeholder' => __( 'e.g. Local pickup', 'woocommerce' ),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'tax_status' => array(
|
||||
|
|
|
@ -86,6 +86,9 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
|
|||
await page.getByRole('button', { name: 'Continue' } ).last().click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
await page
|
||||
.getByPlaceholder( 'e.g. Local pickup' )
|
||||
.fill( 'Local pickup' );
|
||||
await page.locator( '#btn-ok' ).click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
|
@ -146,6 +149,9 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
|
|||
await page.getByRole('button', { name: 'Continue' } ).last().click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
await page
|
||||
.getByPlaceholder( 'e.g. Free shipping' )
|
||||
.fill( 'Free shipping' );
|
||||
await page.locator( '#btn-ok' ).click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
|
@ -202,6 +208,9 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
|
|||
await page.getByRole('button', { name: 'Continue' } ).last().click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
await page
|
||||
.getByPlaceholder( 'e.g. Standard national' )
|
||||
.fill( 'Flat rate' );
|
||||
await page.locator( '#btn-ok' ).click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
|
@ -328,6 +337,9 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
|
|||
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
await page
|
||||
.getByPlaceholder( 'e.g. Standard national' )
|
||||
.fill( 'Flat rate' );
|
||||
await page.locator( '#btn-ok' ).click();
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
|
@ -423,13 +435,20 @@ test.describe( 'Verifies shipping options from customer perspective', () => {
|
|||
method_id: 'flat_rate',
|
||||
settings: {
|
||||
cost: '10.00',
|
||||
title: 'Flat rate',
|
||||
},
|
||||
} );
|
||||
await api.post( `shipping/zones/${ shippingFreeId }/methods`, {
|
||||
method_id: 'free_shipping',
|
||||
settings: {
|
||||
title: 'Free shipping',
|
||||
}
|
||||
} );
|
||||
await api.post( `shipping/zones/${ shippingLocalId }/methods`, {
|
||||
method_id: 'local_pickup',
|
||||
settings: {
|
||||
title: 'Local pickup',
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
|
|
|
@ -78,15 +78,22 @@ test.describe( 'Cart Calculate Shipping', () => {
|
|||
// set shipping zone methods
|
||||
await api.post( `shipping/zones/${ shippingZoneDEId }/methods`, {
|
||||
method_id: 'free_shipping',
|
||||
settings: {
|
||||
title: 'Free shipping',
|
||||
},
|
||||
} );
|
||||
await api.post( `shipping/zones/${ shippingZoneFRId }/methods`, {
|
||||
method_id: 'flat_rate',
|
||||
settings: {
|
||||
title: 'Flat rate',
|
||||
cost: '5.00',
|
||||
},
|
||||
} );
|
||||
await api.post( `shipping/zones/${ shippingZoneFRId }/methods`, {
|
||||
method_id: 'local_pickup',
|
||||
settings: {
|
||||
title: 'Local pickup',
|
||||
},
|
||||
} );
|
||||
// confirm that we allow shipping to any country
|
||||
await api.put( 'settings/general/woocommerce_allowed_countries', {
|
||||
|
|
|
@ -66,6 +66,9 @@ test.describe( 'Shopper Checkout Create Account', () => {
|
|||
] );
|
||||
await api.post( `shipping/zones/${ shippingZoneId }/methods`, {
|
||||
method_id: 'free_shipping',
|
||||
settings: {
|
||||
title: 'Free shipping',
|
||||
}
|
||||
} );
|
||||
await api.put( 'payment_gateways/cod', {
|
||||
enabled: true,
|
||||
|
|
|
@ -62,6 +62,9 @@ test.describe( 'Shopper Checkout Login Account', () => {
|
|||
] );
|
||||
await api.post( `shipping/zones/${ shippingZoneId }/methods`, {
|
||||
method_id: 'free_shipping',
|
||||
settings: {
|
||||
title: 'Free shipping',
|
||||
}
|
||||
} );
|
||||
// create customer and save its id
|
||||
await api
|
||||
|
|
|
@ -67,6 +67,9 @@ test.describe( 'Checkout page', () => {
|
|||
] );
|
||||
await api.post( `shipping/zones/${ shippingZoneId }/methods`, {
|
||||
method_id: 'free_shipping',
|
||||
settings: {
|
||||
title: 'Free shipping',
|
||||
}
|
||||
} );
|
||||
// enable bank transfers and COD for payment
|
||||
await api.put( 'payment_gateways/bacs', {
|
||||
|
|
|
@ -680,7 +680,7 @@ class WC_Tests_API_Shipping_Zones_V2 extends WC_REST_Unit_Test_Case {
|
|||
$data = $response->get_data();
|
||||
|
||||
$this->assertArrayHasKey( 'title', $data['settings'] );
|
||||
$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
|
||||
$this->assertEquals( '', $data['settings']['title']['value'] );
|
||||
$this->assertArrayHasKey( 'tax_status', $data['settings'] );
|
||||
$this->assertEquals( 'taxable', $data['settings']['tax_status']['value'] );
|
||||
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
||||
|
@ -692,6 +692,7 @@ class WC_Tests_API_Shipping_Zones_V2 extends WC_REST_Unit_Test_Case {
|
|||
array(
|
||||
'settings' => array(
|
||||
'cost' => 5,
|
||||
'title' => 'Flat rate',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
|
|
@ -703,7 +703,7 @@ class WC_Tests_API_Shipping_Zones extends WC_REST_Unit_Test_Case {
|
|||
$data = $response->get_data();
|
||||
|
||||
$this->assertArrayHasKey( 'title', $data['settings'] );
|
||||
$this->assertEquals( 'Flat rate', $data['settings']['title']['value'] );
|
||||
$this->assertEquals( '', $data['settings']['title']['value'] );
|
||||
$this->assertArrayHasKey( 'tax_status', $data['settings'] );
|
||||
$this->assertEquals( 'taxable', $data['settings']['tax_status']['value'] );
|
||||
$this->assertArrayHasKey( 'cost', $data['settings'] );
|
||||
|
@ -715,6 +715,7 @@ class WC_Tests_API_Shipping_Zones extends WC_REST_Unit_Test_Case {
|
|||
array(
|
||||
'settings' => array(
|
||||
'cost' => 5,
|
||||
'title' => 'Flat rate',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue