Setup wizard: Show correct shipping text on select

This commit is contained in:
Valerie 2017-09-21 20:17:55 +03:00 committed by Jeff Stieler
parent 1960b6bcd1
commit 0f04645bea
3 changed files with 11 additions and 11 deletions

View File

@ -633,7 +633,7 @@ body {
}
}
.shipping-method-description .live_rates {
.shipping-method-descriptions .live_rates {
color: #a6a6a6;
font-size: 0.92em;
}

View File

@ -45,16 +45,16 @@ jQuery( function( $ ) {
} );
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-shipping-method-select .method', function( e ) {
var $zone = $( this ).parent( 'div' );
var zone = $( this ).closest( '.wc-wizard-service-description' );
var selectedMethod = e.target.value;
var $descriptions = $zone.find( '.shipping-method-description' );
$descriptions.find( 'p' ).hide();
$descriptions.find( 'p.' + selectedMethod ).show();
var description = zone.find( '.shipping-method-descriptions' );
description.find( '.shipping-method-description' ).addClass( 'hide' );
description.find( '.' + selectedMethod ).removeClass( 'hide' );
var $settings = $zone.find( '.shipping-method-settings' );
$settings.find( 'div' ).hide();
$settings.find( 'div.' + selectedMethod ).show();
var settings = zone.find( '.shipping-method-settings' );
settings.find( '.shipping-method-setting' ).addClass( 'hide' );
settings.find( '.' + selectedMethod ).removeClass( 'hide' );
} );
function submitActivateForm() {

View File

@ -622,9 +622,9 @@ class WC_Admin_Setup_Wizard {
</select>
</div>
<div class="shipping-method-description">
<div class="shipping-method-descriptions">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<p class="<?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>">
<p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>">
<?php echo esc_html( $method['description'] ); ?>
</p>
<?php endforeach; ?>
@ -633,7 +633,7 @@ class WC_Admin_Setup_Wizard {
<div class="shipping-method-settings">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<?php if ( empty( $method['settings'] ) ) continue; ?>
<div class="<?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>">
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>">
<?php foreach ( $method['settings'] as $setting_id => $setting ) : ?>
<?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?>
<input type="<?php echo esc_attr( $setting['type'] ); ?>" id="<?php echo esc_attr( $method_setting_id ); ?>" name="<?php echo esc_attr( $method_setting_id ); ?>" />