Merged in feature/117-dev-dev01 (pull request #8)
auto-patch 117-dev-dev01-2023-12-15T16_09_06 * auto-patch 117-dev-dev01-2023-12-15T16_09_06
This commit is contained in:
@@ -8,38 +8,119 @@
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2>
|
||||
<?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Shipping classes can be used to group products of similar type and can be used by some Shipping Methods (such as "Flat rate shipping") to provide different rates to different classes of product.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<span><?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?></span>
|
||||
<a class="button button-primary wc-shipping-class-add-new" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Use shipping classes to customize the shipping rates for different groups of products, such as heavy items that require higher postage fees.', 'woocommerce' ); ?> <a target="_blank" href="https://woocommerce.com/document/product-shipping-classes/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
|
||||
<table class="wc-shipping-classes widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ( $shipping_class_columns as $class => $heading ) : ?>
|
||||
<th class="<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $heading ); ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>">
|
||||
<button type="submit" name="save" class="button button-primary wc-shipping-class-save" value="<?php esc_attr_e( 'Save shipping classes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save shipping classes', 'woocommerce' ); ?></button>
|
||||
<a class="button button-secondary wc-shipping-class-add" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="wc-shipping-class-rows"></tbody>
|
||||
<tbody class="wc-shipping-class-rows wc-shipping-tables-tbody"></tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-row-blank">
|
||||
<tr>
|
||||
<td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
|
||||
<td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) + 1 ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<!-- 1. Placeholder becomes the "label" in view class div -->
|
||||
<!-- 1. Add labelFor or some kind of attribute for semantic HTML-->
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-configure">
|
||||
<div class="wc-backbone-modal wc-shipping-class-modal">
|
||||
<div class="wc-backbone-modal-content" data-id="{{ data.term_id }}">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="term_id" value="{{{ data.term_id }}}" />
|
||||
<?php
|
||||
foreach ( $shipping_class_columns as $class => $heading ) {
|
||||
echo '<div class="wc-shipping-class-modal-input ' . esc_attr( $class ) . '">';
|
||||
switch ( $class ) {
|
||||
case 'wc-shipping-class-name':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?> *
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="name" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'e.g. Heavy', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Give your shipping class a name for easy identification', 'woocommerce' ); ?></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="slug" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'e.g. heavy-packages', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Slug (unique identifier) can be left blank and auto-generated, or you can enter one', 'woocommerce' ); ?></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?> *
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="description" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'e.g. For heavy items requiring higher postage', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-count':
|
||||
break;
|
||||
default:
|
||||
?>
|
||||
<div class="view wc-shipping-class-hide-sibling-view">
|
||||
<?php echo esc_html( $heading ); ?>
|
||||
</div>
|
||||
<?php
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" disabled class="button button-primary button-large disabled">
|
||||
<div class="wc-backbone-modal-action-{{ data.action === 'create' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div>
|
||||
<div class="wc-backbone-modal-action-{{ data.action === 'edit' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div>
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-row">
|
||||
<tr data-id="{{ data.term_id }}">
|
||||
<?php
|
||||
@@ -50,28 +131,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
?>
|
||||
<div class="view">
|
||||
{{ data.name }}
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-class-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="name[{{ data.term_id }}]" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'Shipping class name', 'woocommerce' ); ?>" />
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-class-cancel-edit" href="#"><?php esc_html_e( 'Cancel changes', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">{{ data.slug }}</div>
|
||||
<div class="edit"><input type="text" name="slug[{{ data.term_id }}]" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'Slug', 'woocommerce' ); ?>" /></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">{{ data.description }}</div>
|
||||
<div class="edit"><input type="text" name="description[{{ data.term_id }}]" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'Description for your reference', 'woocommerce' ); ?>" /></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-count':
|
||||
@@ -80,11 +150,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-class-edit wc-shipping-zone-action-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
@@ -24,8 +24,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="zone_name">
|
||||
<?php esc_html_e( 'Zone name', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'This is the name of the zone for your reference.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Give your zone a name! E.g. Local, or Worldwide.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input type="text" data-attribute="zone_name" name="zone_name" id="zone_name" value="<?php echo esc_attr( $zone->get_zone_name( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Zone name', 'woocommerce' ); ?>">
|
||||
@@ -35,48 +37,34 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="zone_locations">
|
||||
<?php esc_html_e( 'Zone regions', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'These are regions inside this zone. Customers will be matched against these regions.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'List the regions you\'d like to include in your shipping zone. Customers will be matched against these regions.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select multiple="multiple" data-attribute="zone_locations" id="zone_locations" name="zone_locations" data-placeholder="<?php esc_attr_e( 'Select regions within this zone', 'woocommerce' ); ?>" class="wc-shipping-zone-region-select chosen_select">
|
||||
<?php
|
||||
foreach ( $shipping_continents as $continent_code => $continent ) {
|
||||
echo '<option value="continent:' . esc_attr( $continent_code ) . '"' . wc_selected( "continent:$continent_code", $locations ) . '>' . esc_html( $continent['name'] ) . '</option>';
|
||||
|
||||
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
|
||||
|
||||
foreach ( $countries as $country_code ) {
|
||||
echo '<option value="country:' . esc_attr( $country_code ) . '"' . wc_selected( "country:$country_code", $locations ) . '>' . esc_html( ' ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
|
||||
$states = WC()->countries->get_states( $country_code );
|
||||
|
||||
if ( $states ) {
|
||||
foreach ( $states as $state_code => $state_name ) {
|
||||
echo '<option value="state:' . esc_attr( $country_code . ':' . $state_code ) . '"' . wc_selected( "state:$country_code:$state_code", $locations ) . '>' . esc_html( ' ' . $state_name . ', ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<td>
|
||||
<div>
|
||||
<div id="wc-shipping-zone-region-picker-root"/>
|
||||
</div>
|
||||
<?php if ( empty( $postcodes ) ) : ?>
|
||||
<a class="wc-shipping-zone-postcodes-toggle" href="#"><?php esc_html_e( 'Limit to specific ZIP/postcodes', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<div class="wc-shipping-zone-postcodes">
|
||||
<textarea name="zone_postcodes" data-attribute="zone_postcodes" id="zone_postcodes" placeholder="<?php esc_attr_e( 'List 1 postcode per line', 'woocommerce' ); ?>" class="input-text large-text" cols="25" rows="5"><?php echo esc_textarea( implode( "\n", $postcodes ) ); ?></textarea>
|
||||
<?php /* translators: WooCommerce link to setting up shipping zones */ ?>
|
||||
<span class="description"><?php printf( __( 'Postcodes containing wildcards (e.g. CB23*) or fully numeric ranges (e.g. <code>90210...99000</code>) are also supported. Please see the shipping zones <a href="%s" target="_blank">documentation</a> for more information.', 'woocommerce' ), 'https://docs.woocommerce.com/document/setting-up-shipping-zones/#section-3' ); ?></span><?php // @codingStandardsIgnoreLine. ?>
|
||||
<span class="description"><?php printf( __( 'Postcodes containing wildcards (e.g. CB23*) or fully numeric ranges (e.g. <code>90210...99000</code>) are also supported. Please see the shipping zones <a href="%s" target="_blank">documentation</a> for more information.', 'woocommerce' ), 'https://woo.com/document/setting-up-shipping-zones/#section-3' ); ?></span><?php // @codingStandardsIgnoreLine. ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<label>
|
||||
<?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Add the shipping methods you\'d like to make available to customers in this zone.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td class="">
|
||||
<table class="wc-shipping-zone-methods widefat">
|
||||
@@ -86,19 +74,19 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th class="wc-shipping-zone-method-title"><?php esc_html_e( 'Title', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-enabled"><?php esc_html_e( 'Enabled', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-method-description"><?php esc_html_e( 'Description', 'woocommerce' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" class="button wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="wc-shipping-zone-method-rows"></tbody>
|
||||
<tbody class="wc-shipping-zone-method-rows wc-shipping-tables-tbody"></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"></th>
|
||||
<td>
|
||||
<button type="submit" class="button button-primary wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -120,16 +108,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<tr data-id="{{ data.instance_id }}" data-enabled="{{ data.enabled }}">
|
||||
<td width="1%" class="wc-shipping-zone-method-sort"></td>
|
||||
<td class="wc-shipping-zone-method-title">
|
||||
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}">{{{ data.title }}}</a>
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-method-delete"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
{{{ data.title }}}
|
||||
</td>
|
||||
<td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td>
|
||||
<td class="wc-shipping-zone-method-description">
|
||||
<strong class="wc-shipping-zone-method-type">{{ data.method_title }}</strong>
|
||||
{{{ data.method_description }}}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-zone-method-settings wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-method-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
@@ -142,8 +131,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: shipping method title */
|
||||
esc_html__( '%s Settings', 'woocommerce' ),
|
||||
'{{{ data.method.method_title }}}'
|
||||
esc_html__( 'Set up %s', 'woocommerce' ),
|
||||
'{{{ data.method.method_title.toLowerCase() }}}'
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
@@ -151,15 +140,20 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article class="wc-modal-shipping-method-settings">
|
||||
<article class="wc-modal-shipping-method-settings" data-id="{{{ data.instance_id }}}" data-status="{{{ data.status }}}" data-shipping-classes-count="<?php echo count( WC()->shipping()->get_shipping_classes() ); ?>">
|
||||
<form action="" method="post">
|
||||
{{{ data.method.settings_html }}}
|
||||
<input type="hidden" name="instance_id" value="{{{ data.instance_id }}}" />
|
||||
</form>
|
||||
<a class="wc-shipping-method-add-class-costs" style="display:none;" target="_blank" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=classes' ) ); ?>"><?php esc_html_e( 'Add shipping class costs', 'woocommerce' ); ?></a>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
|
||||
<button id="btn-ok" data-status='{{ data.status }}' class="button button-primary button-large">
|
||||
<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>
|
||||
<div class="wc-shipping-zone-method-modal-info wc-shipping-zone-method-modal-info-{{ data.status === 'existing' ? 'inactive' : 'active' }}"><?php esc_html_e( 'STEP 2 OF 2', 'woocommerce' ); ?></div>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
@@ -169,36 +163,52 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-wc-modal-add-shipping-method">
|
||||
<div class="wc-backbone-modal">
|
||||
<div class="wc-backbone-modal wc-backbone-modal-add-shipping-method">
|
||||
<div class="wc-backbone-modal-content">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></h1>
|
||||
<h1><?php esc_html_e( 'Create shipping method', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<div class="wc-shipping-zone-method-selector">
|
||||
<p><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></p>
|
||||
<fieldset class="wc-shipping-zone-method-selector">
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></legend>
|
||||
<?php
|
||||
$methods = WC()->shipping()->load_shipping_methods();
|
||||
|
||||
<select name="add_method_id">
|
||||
<?php
|
||||
foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
$methods_placed_in_order = array();
|
||||
$first_methods_ids = array( 'free_shipping', 'flat_rate', 'local_pickup' );
|
||||
|
||||
foreach ( $first_methods_ids as $first_method_id ) {
|
||||
foreach ( $methods as $key => $obj ) {
|
||||
if ( $obj->id === $first_method_id ) {
|
||||
$methods_placed_in_order[] = $obj;
|
||||
unset( $methods[ $key ] );
|
||||
break;
|
||||
}
|
||||
echo '<option data-description="' . esc_attr( wp_kses_post( wpautop( $method->get_method_description() ) ) ) . '" value="' . esc_attr( $method->id ) . '">' . esc_html( $method->get_method_title() ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
|
||||
$methods_placed_in_order = array_merge( $methods_placed_in_order, array_values( $methods ) );
|
||||
|
||||
foreach ( $methods_placed_in_order as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
}
|
||||
$description = wp_kses_post( $method->get_method_description() );
|
||||
echo '<div class="wc-shipping-zone-method-input"><input type="radio" value="' . esc_attr( $method->id ) . '" id="' . esc_attr( $method->id ) . '" name="add_method_id"/><label for="' . esc_attr( $method->id ) . '">' . esc_html( $method->get_method_title() ) . '<span class="dashicons dashicons-yes"></span></label><div class="wc-shipping-zone-method-input-help-text"><span>' . esc_html( $description ) . '</span></div></div>';
|
||||
}
|
||||
?>
|
||||
</fieldset>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
<button id="btn-next" disabled class="button button-primary button-large disabled"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<div class="wc-shipping-zone-method-modal-info"><?php esc_html_e( 'STEP 1 OF 2', 'woocommerce' ); ?></div>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
|
||||
@@ -5,10 +5,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
?>
|
||||
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<?php _e( 'Shipping zones', 'woocommerce' ); ?>
|
||||
<a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ); ?>" class="page-title-action"><?php esc_html_e( 'Add shipping zone', 'woocommerce' ); ?></a>
|
||||
<span><?php esc_html_e( 'Shipping zones', 'woocommerce' ); ?></span>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ) ); ?>" class="button-primary"><?php esc_html_e( 'Add zone', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
<p><?php echo __( 'A shipping zone is a geographic region where a certain set of shipping methods are offered.', 'woocommerce' ) . ' ' . __( 'WooCommerce will match a customer to a single zone using their shipping address and present the shipping methods within that zone to them.', 'woocommerce' ); ?></p>
|
||||
<p class="wc-shipping-zone-heading-help-text"><?php echo esc_html_e( 'A shipping zone consists of the region(s) you\'d like to ship to and the shipping method(s) offered. A shopper can only be matched to one zone, and we\'ll use their shipping address to show them the methods available in their area.', 'woocommerce' ); ?></p>
|
||||
<table class="wc-shipping-zones widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -16,39 +16,40 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<th class="wc-shipping-zone-name"><?php esc_html_e( 'Zone name', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-region"><?php esc_html_e( 'Region(s)', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-methods"><?php esc_html_e( 'Shipping method(s)', 'woocommerce' ); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="wc-shipping-zone-rows"></tbody>
|
||||
<tbody>
|
||||
<tr data-id="0" class="wc-shipping-zone-worldwide">
|
||||
<td width="1%" class="wc-shipping-zone-worldwide"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=0' ) ); ?>"><?php esc_html_e( 'Locations not covered by your other zones', 'woocommerce' ); ?></a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id=0"><?php _e( 'Manage shipping methods', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php _e( 'This zone is <b>optionally</b> used for regions that are not included in any other shipping zone.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<ul>
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
uasort( $methods, 'wc_shipping_zone_method_order_uasort_comparison' );
|
||||
<tbody class="wc-shipping-zone-rows wc-shipping-tables-tbody"></tbody>
|
||||
|
||||
if ( ! empty( $methods ) ) {
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li class="wc-shipping-zone-method ' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</li>';
|
||||
}
|
||||
} else {
|
||||
echo '<li class="wc-shipping-zone-method">' . __( 'No shipping methods offered to this zone.', 'woocommerce' ) . '</li>';
|
||||
<tfoot data-id="0" class="wc-shipping-zone-worldwide">
|
||||
<td width="1%" class="wc-shipping-zone-worldwide"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<?php esc_html_e( 'Rest of the world', 'woocommerce' ); ?>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php esc_html_e( 'An optional zone you can use to set the shipping method(s) available to any regions that have not been listed above.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<ul>
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
uasort( $methods, 'wc_shipping_zone_method_order_uasort_comparison' );
|
||||
|
||||
if ( ! empty( $methods ) ) {
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li class="wc-shipping-zone-method ' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
} else {
|
||||
echo '<li>' . esc_html_e( 'No shipping methods offered to this zone.', 'woocommerce' ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<a class="wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&zone_id=0"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-zone-row-blank">
|
||||
@@ -73,10 +74,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<tr data-id="{{ data.zone_id }}">
|
||||
<td width="1%" class="wc-shipping-zone-sort"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}">{{ data.zone_name }}</a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-delete"><?php _e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
{{ data.zone_name }}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region">
|
||||
{{ data.formatted_zone_location }}
|
||||
@@ -84,6 +82,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<div><ul></ul></div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user