php - 将自定义获取参数添加到 woocomerce 感谢页面
问题描述
如果 order_amount 超过 50 美元,我需要将自定义 get 参数添加到 woocomerce 感谢页面。我需要它来进行跟踪。也许有人有它的功能?标准页面链接:
https://somesite.com/checkout/order-received/1111110/?key=wc_order_C5OOjXBZyAdqx
并带有订单金额参数
https://somesite.com/checkout/order-received/1111110/?key=wc_order_C5OOjXBZyAdqx&order_amount=50
解决方案
你可以这样做:
add_filter('woocommerce_get_return_url', 'wc_override_thankyou_url', 10, 2 );
function wc_override_thankyou_url( $url, $order ){
if( $order->get_total() >= 50 ){
$url = $url . '&order_amount=50';
}
return $url;
}
推荐阅读
- gmail - 如何通过 Gmail API 在 JavaScript 中发送带有附件和消息的邮件
- python-3.x - 如何比较网络上的图像以查看它们在 python3 中是否相同?
- vba - 如何使这个亚洲字体突出显示宏识别字间字符?
- reactjs - 当函数依赖于它设置的值时,如何使用 useEffect 防止无限循环?
- html - 在 safari 中导航路线时,svg 未正确呈现,角度
- c++ - 为什么这个函数按升序打印 1 2 3 4 5
- r - 如何将假期影响适应每周数据?
- c - main() 函数中一个简单程序的分段错误错误
- sql - 如何定位连接表中的行,该连接表与另一个表在其任何行中包含特定值?
- ruby-on-rails - 如何在 def 函数之外在 Rails 中使用请求?