在WooCommerce中,是否可以自动将免费送货应用于任何正在销售的产品? 每个月我们都有不同的产品在销售,所有销售的产品都自动有资格享受免费送货。对于销售产品,我目前必须手动将发货类别更改为“免费发货”,然后在销售结束时返回“标准发货”。我想自动化这一点,使任何产品在销售中,自动资格的订单免费送货。 我可以申请每个产品ID的免费送货,但我还不能弄清楚这是否适用于销售产品。 function wcs_my_free_shipping( $is_available ) {
global $woocommerce;
// set the product ids that a
以下代码将允许特定产品的免费送货:
function wcs_my_free_shipping( $is_available ) {
global $woocommerce;
// set the product ids that are eligible
$eligible = array( '360' );
// get cart contents
$cart_items = $woocommerce->cart->get_cart();
// loop through the items looki
WooCommerce对国家的定义如下(为简洁而编辑):
class WC_Countries {
public $countries;
public function __construct() {
global $woocommerce, $states;
$this->countries = apply_filters( 'woocommerce_countries', array(
'AF' => __( 'Afghanistan', 'woo
我正在使用woocommerce,发现当免费送货可用时,我可以隐藏送货方式。
但现在的问题是我需要隐藏两个而不是一个。每当我尝试隐藏两个方法时,我的整个页面都会变黑。
我需要专家帮我解决这个问题。提前感谢一百万!
// Hide standard shipping option when free shipping is available
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );
您能告诉我如何调整这个片段(它禁用某个产品的免费送货方法),以便在购物车有产品/S指定某个运输类时禁用免费送货方法?(WooCommerce 4.2+)
任何帮助都很感激。谢谢。
function my_free_shipping( $is_available ) {
global $woocommerce;
// set the product ids that are ineligible
$ineligible = array( '4743' );
// get cart contents
$cart_items = $wooc
一直在编写一条消息,通知客户送货的情况,如果他/她再花费XX美元,就可以免费送货。
我已经使用了各种挂钩,这是在哪里显示(产品页,购物车,结帐等),但我有真正的麻烦是如何绕过成本。
如果客户花费至少59美元,它将提供免费送货服务。但是,如果客户为58.xx添加产品,消息将显示为,"Spend 0.1223242 dollars more and get free shipping"。
我如何将它转换成两个小数,以及如何使它理解0.1223等于0.10,0.15544等于0.2等等?(我希望这是清楚易懂的)。
下面是我使用的代码:
function show_shipping_m