Last active
July 1, 2019 16:30
-
-
Save nczz/96ba05062531468f754b8f0cd449f876 to your computer and use it in GitHub Desktop.
結帳頁面顯示運費計算功能 https://www.mxp.tw/8550/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function action_woocommerce_before_checkout_form($wccm_autocreate_account) { | |
wc_cart_totals_shipping_html(); | |
woocommerce_shipping_calculator('選取運送方式'); | |
}; | |
add_action('woocommerce_before_checkout_form', 'action_woocommerce_before_checkout_form', 10, 1); | |
function woocommerce_shipping_calculator_scripts() { | |
if (is_checkout()) { | |
if (wp_script_is('wc-cart', 'registered') && !wp_script_is('wc-cart', 'enqueued')) { | |
wp_enqueue_script('wc-cart'); | |
} | |
} | |
} | |
add_action('wp_enqueue_scripts', 'woocommerce_shipping_calculator_scripts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment