从checkout向woocommerce订阅重复总额加定制费 [英] Add custom fee to woocommerce subscription recurring total fromcheckout
问题描述
自定义结帐字段,它是一个选择字段,用于在结帐时向总价添加价格.
A custom checkout field which is a select field that is used to add a price to total price in checkout.
使用 WooCommerce订阅插件时,也会出现经常性总计.所以有什么办法,我也可以将自定义结帐字段价格添加到重复总额中吗?
When using WooCommerce Subscription plugin Recurring Total also appears. So is there any way, i can add custom checkout field price to recurring total too ?
请也检查此问题.一个类似的
Please check this question too. A similar one
推荐答案
Hey you may want to check out this doc from Woocommerce
来源:
默认情况下,使用woocommerce_cart_calculate_fees挂钩添加的所有购物车费用都将同时应用于初始订单和为此交易创建的任何订阅.然后,这些费用也将应用于后续交易."
"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订阅2.2.16引入了> woocommerce_subscriptions_is_recurring_fee过滤器.该过滤器允许已向初始购物车收取费用的开发人员也将费用应用于定期购物车."
"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."
这似乎与先前的陈述相矛盾,但是您可能想要尝试添加以下内容:
Which seems to contradict the previous statement but you may want to try adding this:
add_filter( 'woocommerce_subscriptions_is_recurring_fee', '__return_true' );
没有代码片段,我不确定您使用的是什么钩子,但是该资源包含一些您可以尝试使用的示例!
Without a code snippet, I'm unsure what hooks you're using, but the resource contains a few examples that you may be able to try!
这篇关于从checkout向woocommerce订阅重复总额加定制费的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!