将自定义费用添加到来自结帐的 woocommerce 订阅重复总数 [英] Add custom fee to woocommerce subscription recurring total fromcheckout

查看:20
本文介绍了将自定义费用添加到来自结帐的 woocommerce 订阅重复总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自定义结帐字段,这是一个选择字段,用于在结帐时将价格添加到总价.

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

使用 WooCommerce 订阅 插件时 Recurring Total 也会出现.那么有什么办法,我也可以将自定义结帐字段价格添加到经常性总额中吗?

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

将自定义费用添加到经常性的 woocommerce 订阅总额

推荐答案

嘿,你可能想看看这个 来自 Woocommerce 的文档

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!

这篇关于将自定义费用添加到来自结帐的 woocommerce 订阅重复总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆