Changeset 3411217
- Timestamp:
- 12/04/2025 04:56:14 PM (4 months ago)
- Location:
- free-shipping-hide-other-methods-woo/trunk
- Files:
-
- 4 edited
-
free-shipping-hide-other-methods-woo.php (modified) (2 diffs)
-
includes/class-wc-shipping-flat-rate-hide-others.php (modified) (2 diffs)
-
includes/class-wc-shipping-free-shipping-hide-others.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
free-shipping-hide-other-methods-woo/trunk/free-shipping-hide-other-methods-woo.php
r3290560 r3411217 4 4 * Plugin URI: 5 5 * Description: Alternative WooCommerce “Free Shipping” and “Flat Rate” methods that allows the shop owner to select and make unavailable any other shipping methods on the same zone when this one is available 6 * Version: 2. 36 * Version: 2.4 7 7 * Author: Naked Cat Plugins (by Webdados) 8 8 * Author URI: https://nakedcatplugins.com … … 12 12 * Requires PHP: 7.2 13 13 * WC requires at least: 7.1 14 * WC tested up to: 9.814 * WC tested up to: 10.4 15 15 * Requires Plugins: woocommerce 16 16 * License: GPLv3 -
free-shipping-hide-other-methods-woo/trunk/includes/class-wc-shipping-flat-rate-hide-others.php
r3188905 r3411217 158 158 */ 159 159 public static function enqueue_admin_js() { 160 wc_enqueue_js( 160 $handle = 'flat-rate-hide-others-admin'; 161 wp_register_script( $handle, '', array( 'jquery' ), WC_VERSION, array( 'in_footer' => true ) ); 162 wp_enqueue_script( $handle ); 163 wp_add_inline_script( 164 $handle, 161 165 "jQuery( function( $ ) { 162 166 function wcFlatRateHideOthersShowHideMinAmountField( el ) { 163 167 var form = $( el ).closest( 'form' ); 164 var shippingClassField = $( '#woocommerce_flat_rate_hide_others_fso_shipping_class', form ).closest( 'tr' ); 168 var shippingClassField = $( '#woocommerce_flat_rate_hide_others_fso_shipping_class', form ).closest( 'tr' ); 169 var shippingClassFieldLabel = null; 170 if ( shippingClassField.length === 0 ) { 171 var shippingClassField = $( '#woocommerce_flat_rate_hide_others_fso_shipping_class', form ).closest( 'fieldset' ); 172 var shippingClassFieldLabel = $( 'label[for=woocommerce_flat_rate_hide_others_fso_shipping_class]' ); 173 } 165 174 switch( $( el ).val() ) { 166 175 case '': 167 176 shippingClassField.hide(); 177 shippingClassFieldLabel?.hide(); 168 178 break; 169 179 case 'fsho_shipping_class': 170 180 shippingClassField.show(); 181 shippingClassFieldLabel?.show(); 171 182 break; 172 183 } … … 184 195 } 185 196 } ); 186 } );"197 } );" 187 198 ); 188 199 } -
free-shipping-hide-other-methods-woo/trunk/includes/class-wc-shipping-free-shipping-hide-others.php
r3188905 r3411217 132 132 */ 133 133 public static function enqueue_admin_js() { 134 wc_enqueue_js( 134 $handle = 'free-shipping-hide-others-admin'; 135 wp_register_script( $handle, '', array( 'jquery' ), WC_VERSION, array( 'in_footer' => true ) ); 136 wp_enqueue_script( $handle ); 137 wp_add_inline_script( 138 $handle, 135 139 "jQuery( function( $ ) { 136 140 function wcFreeShippingHideOthersShowHideMinAmountField( el ) { 137 141 var form = $( el ).closest( 'form' ); 138 var minAmountField = $( '#woocommerce_free_shipping_hide_others_min_amount', form ).closest( 'tr' ); 139 var ignoreDiscountField = $( '#woocommerce_free_shipping_hide_others_ignore_discounts', form ).closest( 'tr' ); 142 var minAmountField = $( '#woocommerce_free_shipping_hide_others_min_amount', form ).closest( 'tr' ); 143 var minAmountFieldLabel = null; 144 if ( minAmountField.length === 0 ) { 145 var minAmountField = $( '#woocommerce_free_shipping_hide_others_min_amount', form ).closest( 'fieldset' ); 146 var minAmountFieldLabel = $( 'label[for=woocommerce_free_shipping_hide_others_min_amount]' ); 147 } 148 var ignoreDiscountField = $( '#woocommerce_free_shipping_hide_others_ignore_discounts', form ).closest( 'tr' ); 149 var ignoreDiscountFieldLabel = null; 150 if ( ignoreDiscountField.length === 0 ) { 151 var ignoreDiscountField = $( '#woocommerce_free_shipping_hide_others_ignore_discounts', form ).closest( 'fieldset' ); 152 var ignoreDiscountFieldLabel = $( 'label[for=woocommerce_free_shipping_hide_others_ignore_discounts]' ); 153 } 140 154 var shippingClassField = $( '#woocommerce_free_shipping_hide_others_fso_shipping_class', form ).closest( 'tr' ); 155 var shippingClassFieldLabel = null; 156 if ( shippingClassField.length === 0 ) { 157 var shippingClassField = $( '#woocommerce_free_shipping_hide_others_fso_shipping_class', form ).closest( 'fieldset' ); 158 var shippingClassFieldLabel = $( 'label[for=woocommerce_free_shipping_hide_others_fso_shipping_class]' ); 159 } 141 160 switch( $( el ).val() ) { 142 161 case '': 143 162 case 'coupon': 144 163 minAmountField.hide(); 164 minAmountFieldLabel?.hide(); 145 165 ignoreDiscountField.hide(); 166 ignoreDiscountFieldLabel?.hide(); 146 167 shippingClassField.hide(); 168 shippingClassFieldLabel?.hide(); 147 169 break; 148 170 case 'fsho_shipping_class': 149 171 minAmountField.hide(); 172 minAmountFieldLabel?.hide(); 150 173 ignoreDiscountField.hide(); 174 ignoreDiscountFieldLabel?.hide(); 151 175 shippingClassField.show(); 176 shippingClassFieldLabel?.show(); 152 177 break; 153 178 default: 154 179 minAmountField.show(); 180 minAmountFieldLabel?.show(); 155 181 ignoreDiscountField.show(); 182 ignoreDiscountFieldLabel?.show(); 156 183 shippingClassField.hide(); 184 shippingClassFieldLabel?.hide(); 157 185 break; 158 186 } … … 161 189 $( document.body ).on( 'change', '#woocommerce_free_shipping_hide_others_requires', function() { 162 190 wcFreeShippingHideOthersShowHideMinAmountField( this ); 163 } );191 } ); 164 192 165 193 // Change while load. … … 170 198 } 171 199 } ); 172 } );"200 } );" 173 201 ); 174 202 } -
free-shipping-hide-other-methods-woo/trunk/readme.txt
r3290560 r3411217 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2 8 Stable tag: 2. 38 Stable tag: 2.4 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 73 73 == Changelog == 74 74 75 = 2.4 - 2025-12-04 = 76 * [DEV] Stop using `wc_enqueue_js` which is deprecated from WooCommerce 10.4 77 * [FIX] Fields not correctly hidden on the new WooCommerce admin interface 78 * [DEV] Tested with WordPress 7.0-alpha-61349 and WooCommerce 10.4.0-beta.2 79 75 80 = 2.3 - 2025-05-09 = 76 81 * [NEW] We are now called Naked Cat Plugins 😻
Note: See TracChangeset
for help on using the changeset viewer.