相关疑难解决方法(0)

woocommerce_shipping_free_shipping_is_available 不起作用

我在 WordPress 安装中对 WooCommerce 进行了自定义。

我有类似的东西:

/**
 * Disable free shipping for select products
 *
 * @param bool $is_available
 */
function my_free_shipping( $is_available ) {
    global $woocommerce;

    // set the product ids that are ineligible
    $ineligible = array( '14009', '14031' );

    // get cart contents
    $cart_items = $woocommerce->cart->get_cart();

    // loop through the items looking for one in the ineligible array
    foreach ( $cart_items as $key => $item ) {
        if( in_array( $item['product_id'], $ineligible ) ) {
            return false;
        }
    } …
Run Code Online (Sandbox Code Playgroud)

php wordpress shipping woocommerce hook-woocommerce

5
推荐指数
0
解决办法
2013
查看次数

在 WooCommerce 3 中提供免费送货时隐藏特定的统一费率

在 WooCommerce 3 中,我有这些运输选项(设置):

  1. 免费送货:free_shipping:1- 最低订单金额设置为$50
  2. 正常运输flat_rate:3- 金额$5
  3. 快递运输flat_rate:5- 金额$10

我希望快递运输选项始终可用(如图所示)。

但是当免费送货可用时(意味着客户在购物车中的金额超过 50 美元),我只想隐藏 正常送货

所以,当Free shipping提供(或隐藏),可用的运费将是正常的运输和快递运输。

那可能吗?我怎样才能在 WooCommerce 3 上获得这个?

php wordpress shipping cart woocommerce

2
推荐指数
1
解决办法
3231
查看次数

标签 统计

php ×2

shipping ×2

woocommerce ×2

wordpress ×2

cart ×1

hook-woocommerce ×1