将自定义费用添加到结账时的 woocommerce 订阅经常性总计
Add custom fee to woocommerce subscription recurring total fromcheckout
一个自定义结帐字段,它是一个 select 字段,用于在结帐时将价格添加到总价中。
当使用 WooCommerce Subscription 插件时 Recurring Total 也会出现。那么有什么办法,我也可以将自定义结帐字段价格添加到经常性总计中吗?
请也检查这个问题。类似的
Add custom fee to recurring total woocommerce subscription
嘿,你可能想看看这个 doc from Woocommerce
来源:
"by default, any cart fees added using the woocommerce_cart_calculate_fees hook will be >applied both to both the initial order, and any subscriptions created for that >transaction. Those fees are then also applied to subsequent transactions."
后来,他们说
"WooCommerce Subscriptions 2.2.16 introduced the >woocommerce_subscriptions_is_recurring_fee filter. This filter allows developers who >have applied fees to the initial cart to also apply the fees to the recurring cart."
这似乎与前面的陈述相矛盾,但您可能想尝试添加以下内容:
add_filter( 'woocommerce_subscriptions_is_recurring_fee', '__return_true' );
没有代码片段,我不确定您使用的是什么钩子,但该资源包含一些您可以尝试的示例!
一个自定义结帐字段,它是一个 select 字段,用于在结帐时将价格添加到总价中。
当使用 WooCommerce Subscription 插件时 Recurring Total 也会出现。那么有什么办法,我也可以将自定义结帐字段价格添加到经常性总计中吗?
请也检查这个问题。类似的
Add custom fee to recurring total woocommerce subscription
嘿,你可能想看看这个 doc from Woocommerce
来源:
"by default, any cart fees added using the woocommerce_cart_calculate_fees hook will be >applied both to both the initial order, and any subscriptions created for that >transaction. Those fees are then also applied to subsequent transactions."
后来,他们说
"WooCommerce Subscriptions 2.2.16 introduced the >woocommerce_subscriptions_is_recurring_fee filter. This filter allows developers who >have applied fees to the initial cart to also apply the fees to the recurring cart."
这似乎与前面的陈述相矛盾,但您可能想尝试添加以下内容:
add_filter( 'woocommerce_subscriptions_is_recurring_fee', '__return_true' );
没有代码片段,我不确定您使用的是什么钩子,但该资源包含一些您可以尝试的示例!