Add custom fee to woocommerce subscription recurring total fromcheckout

时光怂恿深爱的人放手 提交于 2019-12-11 10:26:15

问题


A custom checkout field which is a select field that is used to add a price to total price in checkout.

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

Add custom fee to recurring total woocommerce subscription


回答1:


Hey you may want to check out this doc from Woocommerce

From the source:

"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."

Later on, they say

"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!



来源:https://stackoverflow.com/questions/54553337/add-custom-fee-to-woocommerce-subscription-recurring-total-fromcheckout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!