根据这个答案:在WooCommerce中基于时间和日期的条件交货通知,我正在基于特定的运输条件获取一条运输信息。
现在我意识到我需要在WooCommerce中设置免费运输方式,并且为此,我需要告知客户还需要多少金额才能获得免费运输。
因此,我找到了这段代码:
但我在将此消息与其他消息合并并将其转换为
现在我意识到我需要在WooCommerce中设置免费运输方式,并且为此,我需要告知客户还需要多少金额才能获得免费运输。
因此,我找到了这段代码:
$total_cart = WC()->cart->total;
$limit_for_free_shipping = 99;
if ($total_cart != 0 && $total_cart < $limit_free_shipping ) {
$difference = wc_price( round($limit_for_free_shipping - $total_cart, 2) );
?>
<p class="spend_message" >
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/shipping-icon.png"> <?php _e('If you spend another '); ?> <?php echo $diff; ?> <?php _e(', you will get '); ?> <strong><?php _e('FREE SHIPPING!'); ?></strong>
</p>
<?php
}
但我在将此消息与其他消息合并并将其转换为
<p>
标签而不是wc-notice
方面遇到了麻烦。