问题
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