Changeset 2583051
- Timestamp:
- 08/15/2021 07:25:26 AM (5 years ago)
- Location:
- mulutu/trunk
- Files:
-
- 4 edited
-
MulutuWCFront.php (modified) (5 diffs)
-
plugin.php (modified) (1 diff)
-
readme.md (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mulutu/trunk/MulutuWCFront.php
r2579788 r2583051 8 8 class MulutuWCFront { 9 9 10 function disableShippingCalcOnCart( $show _shipping ) {10 function disableShippingCalcOnCart( $showShipping ) { 11 11 if( is_cart() ) { 12 12 return false; 13 13 } 14 return $show _shipping;14 return $showShipping; 15 15 } 16 16 … … 19 19 unset($fields['billing']['billing_postcode']); 20 20 21 $fields['billing']['billing_city']['class'] = array('d-none'); 21 $onlyVirtual = true; 22 foreach( WC()->cart->get_cart() as $cartItem ) { 23 if (!$cartItem['data']->is_virtual()) { 24 $onlyVirtual = false; 25 } 26 } 22 27 23 $fields['billing']['billing_address_1'] = array( 24 'class' => array ('d-none'), 25 'required' => false 26 ); 27 28 $fields['billing']['billing_address_1_text'] = array( 29 'label' => 'Địa chỉ', 30 'placeholder' => 'Địa chỉ', 31 'class' => array ('form-row', 'address-field', 'validate-required', 'form-row-wide'), 32 'priority' => 40, 33 'required' => true 34 ); 35 36 $fields['billing']['billing_district'] = array( 37 'type' => 'select', 38 'required' => true, 39 'priority' => 40, 40 'class' => array( 'form-row', 'form-row-first', 'validate-required' ), 41 'label' => __( 'Quận / Huyện' ), 42 'options' => array( 43 -1 => __( 'Chọn quận huyện', 'Chọn quận huyện' ) 44 ) 45 ); 46 47 $fields['billing']['billing_ward'] = array( 48 'type' => 'select', 49 'required' => true, 50 'priority' => 40, 51 'class' => array( 'form-row', 'form-row-last', 'validate-required' ), 52 'label' => __( 'Phường / Xã' ), 53 'options' => array( 54 -1 => __( 'Chọn phường xã', 'Chọn phường xã' ) 55 ) 56 ); 28 if ($onlyVirtual) { 29 unset($fields['billing']['billing_address_1']); 30 unset($fields['billing']['billing_address_2']); 31 unset($fields['billing']['billing_city']); 32 unset($fields['billing']['billing_country']); 33 unset($fields['billing']['billing_state']); 34 add_filter( 'woocommerce_enable_order_notes_field', '__return_false' ); 35 } else { 36 $fields['billing']['billing_city']['class'] = array('d-none'); 37 $fields['billing']['billing_address_1'] = array( 38 'class' => array('d-none'), 39 'required' => false 40 ); 41 $fields['billing']['billing_address_1_text'] = array( 42 'label' => 'Địa chỉ', 43 'placeholder' => 'Địa chỉ', 44 'class' => array ('form-row', 'address-field', 'validate-required', 'form-row-wide'), 45 'priority' => 41, 46 'required' => true 47 ); 48 $fields['billing']['billing_district'] = array( 49 'type' => 'select', 50 'required' => true, 51 'priority' => 40, 52 'class' => array( 'form-row', 'form-row-first', 'validate-required' ), 53 'label' => __( 'Quận / Huyện' ), 54 'options' => array( 55 -1 => __( 'Chọn quận huyện', 'Chọn quận huyện' ) 56 ) 57 ); 58 $fields['billing']['billing_ward'] = array( 59 'type' => 'select', 60 'required' => true, 61 'priority' => 40, 62 'class' => array( 'form-row', 'form-row-last', 'validate-required' ), 63 'label' => __( 'Phường / Xã' ), 64 'options' => array( 65 -1 => __( 'Chọn phường xã', 'Chọn phường xã' ) 66 ) 67 ); 68 } 57 69 58 70 return $fields; … … 120 132 )); 121 133 } 122 123 134 } 124 135 … … 126 137 127 138 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 139 /** 140 * @todo Add Cart page support 141 */ 128 142 add_filter('woocommerce_cart_ready_to_calc_shipping', array($objMulutuWCFront, 'disableShippingCalcOnCart'), 99); 129 143 … … 134 148 add_filter('woocommerce_checkout_fields', array($objMulutuWCFront, 'overrideCheckoutFields')); 135 149 add_action('woocommerce_after_checkout_form', array($objMulutuWCFront, 'debounceAddJSScriptCheckout')); 150 add_filter('woocommerce_cart_needs_shipping_address', '__return_false'); -
mulutu/trunk/plugin.php
r2579798 r2583051 9 9 * Plugin URI: https://mulutu.vn/ 10 10 * Description: Plugin provides basic function for GHN Panel. 11 * Version: 1.1. 111 * Version: 1.1.2 12 12 * Text Domain: mulutu 13 13 * Author: Mulutu team -
mulutu/trunk/readme.md
r2579798 r2583051 31 31 32 32 ### Changelog 33 1.1.2 34 * Fix bug 35 * Support virtual products 33 36 1.1.1 34 37 * Fix bug -
mulutu/trunk/readme.txt
r2579800 r2583051 5 5 Tested up to: 5.8 6 6 Requires PHP: 5.6 7 Stable tag: 1.1. 17 Stable tag: 1.1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 37 37 38 38 == Changelog == 39 = 1.1.2 = 40 * Fix bug 41 * Support virtual products 39 42 40 43 = 1.1.1 =
Note: See TracChangeset
for help on using the changeset viewer.