Tagged: wordpress Toggle Comment Threads | 快速鍵

  • starway 1:40 pm on August 4, 2018 固定鏈結 | 回應
    Tags: wordpress   

    WooCommerce 購物網站的免運費機制 

    自動偵測免費運送的設定方法
    打開主題中的 functions.php
    將下方的程式片段碼貼入後存檔

    更新 for WC 2.6+

    /**

    • Hide shipping rates when free shipping is available.
    • Updated to support WooCommerce 2.6 Shipping Zones.
    • @param array $rates Array of rates found for the package.
    • @return array

    */
    add_filter( ‘woocommerce_package_rates’, ‘hide_shipping_when_free_is_available’, 100 );
    function hide_shipping_when_free_is_available( $rates ) {
    $free = array();

    foreach ( $rates as $rate_id => $rate ) {
    if ( ‘free_shipping’ === $rate->method_id ) {
    $free[ $rate_id ] = $rate;
    break;
    }
    }

    return ! empty( $free ) ? $free : $rates;
    }

    更新 for WC 2.5

    /**

    • woocommerce_package_rates is a 2.1+ hook

    */
    add_filter( ‘woocommerce_package_rates’, ‘hide_shipping_when_free_is_available’, 10, 2 );

    /**

    • Hide shipping rates when free shipping is available
    • @param array $rates Array of rates found for the package
    • @param array $package The package array/object being shipped
    • @return array of modified rates

    */
    function hide_shipping_when_free_is_available( $rates, $package ) {

    // Only modify rates if free_shipping is present
    if ( isset( $rates[‘free_shipping’] ) ) {

    // To unset a single rate/method, do the following. This example unsets flat_rate shipping
    unset( $rates[‘flat_rate’] );

    // To unset all methods except for free_shipping, do the following
    $free_shipping = $rates[‘free_shipping’];
    $rates = array();
    $rates[‘free_shipping’] = $free_shipping;
    }

    return $rates;
    }

    最後還要在 WooCommerce 的後台,設定免運費的金額限制

    參考:
    https://cloudwp.pro/blog/woocommerce-%E8%B3%BC%E7%89%A9%E7%B6%B2%E7%AB%99%E7%9A%84%E5%85%8D%E9%81%8B%E8%B2%BB%E6%A9%9F%E5%88%B6%E5%BB%BA%E8%AD%B0/

    廣告
     
  • starway 11:17 am on May 27, 2017 固定鏈結 | 回應
    Tags: wordpress   

    Quickly Disable or Enable All WordPress Plugins via the Database
    https://perishablepress.com/quickly-disable-or-enable-all-wordpress-plugins-via-the-database/

     
  • starway 7:57 am on May 27, 2017 固定鏈結 | 回應
    Tags: wordpress   

    有質感的 wordpress theme 

    http://bridgelanding.qodeinteractive.com/

    http://demos.artbees.net/jupiter5/templates/

    http://flatsome3.uxthemes.com/?style=layout-vendor-shop#

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
回應
e
編輯
o
Show/Hide comments
t
至頂
l
Go to login
h
Show/Hide help
shift + esc
取消