Merge pull request #16050 from woocommerce/update/15985
Use select2 in cart
This commit is contained in:
commit
a7582d50da
|
@ -175,6 +175,7 @@ jQuery( function( $ ) {
|
|||
*/
|
||||
toggle_shipping: function() {
|
||||
$( '.shipping-calculator-form' ).slideToggle( 'slow' );
|
||||
$( document.body ).trigger( 'country_to_state_changed' ); // Trigger select2 to load.
|
||||
return false;
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -371,7 +371,7 @@ class WC_Frontend_Scripts {
|
|||
if ( is_cart() ) {
|
||||
self::enqueue_script( 'wc-cart' );
|
||||
}
|
||||
if ( is_checkout() || is_account_page() ) {
|
||||
if ( is_cart() || is_checkout() || is_account_page() ) {
|
||||
self::enqueue_script( 'selectWoo' );
|
||||
self::enqueue_style( 'select2' );
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.0.8
|
||||
* @version 3.2.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -24,9 +24,9 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->
|
|||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
wp_enqueue_script( 'wc-country-select' );
|
||||
|
||||
<?php do_action( 'woocommerce_before_shipping_calculator' ); ?>
|
||||
do_action( 'woocommerce_before_shipping_calculator' ); ?>
|
||||
|
||||
<form class="woocommerce-shipping-calculator" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
|
||||
|
@ -35,7 +35,7 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->
|
|||
<section class="shipping-calculator-form" style="display:none;">
|
||||
|
||||
<p class="form-row form-row-wide" id="calc_shipping_country_field">
|
||||
<select name="calc_shipping_country" id="calc_shipping_country" class="country_to_state" rel="calc_shipping_state">
|
||||
<select name="calc_shipping_country" id="calc_shipping_country" class="country_to_state country_select" rel="calc_shipping_state">
|
||||
<option value=""><?php _e( 'Select a country…', 'woocommerce' ); ?></option>
|
||||
<?php
|
||||
foreach ( WC()->countries->get_shipping_countries() as $key => $value ) {
|
||||
|
@ -60,7 +60,7 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->
|
|||
} elseif ( is_array( $states ) ) {
|
||||
|
||||
?><span>
|
||||
<select name="calc_shipping_state" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / County', 'woocommerce' ); ?>">
|
||||
<select name="calc_shipping_state state_select" class="state_select" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / County', 'woocommerce' ); ?>">
|
||||
<option value=""><?php esc_html_e( 'Select a state…', 'woocommerce' ); ?></option>
|
||||
<?php
|
||||
foreach ( $states as $ckey => $cvalue ) {
|
||||
|
|
Loading…
Reference in New Issue