【发布时间】:2021-05-14 11:13:51
【问题描述】:
我需要计算免费送货前的价格。我有两个运输区,我需要知道哪个是最新的。我只设法获得了所有已定义的运输区域,但找不到任何东西来获取有关当前运输区域的信息。这必须根据运费计算器进行相应更改。
有没有办法获取当前的送货区域?
function action_woocommerce_cart_totals_after_order_total() {
echo 'Bis kostenloser versand'; // till free shipping
$IsValue = WC()->cart->get_subtotal();
$delivery_zones = WC_Shipping_Zones::get_zones();
foreach ((array) $delivery_zones as $key => $the_zone ) {
echo $the_zone['zone_name'];
// I need to know which is current
}
};
add_action( 'woocommerce_cart_totals_after_order_total', 'action_woocommerce_cart_totals_after_order_total', 10, 0 );
【问题讨论】:
标签: wordpress woocommerce storefront