Woocommerce 添加功能以在购物车中显示项目后运行 [英] Woocommerce add function to run after display items in cart

查看:24
本文介绍了Woocommerce 添加功能以在购物车中显示项目后运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在商品列表后在购物车页面中显示消息.但我想通过钩子/函数添加它,而不是编辑购物车页面.无法找到确切的方法.但它可能看起来像:

I want to display message in cart page after items list. But i want to add it through a hook/function ,not with editing the cart page. Cant find exactly how to do it. but its probably looks something like:

add_action( 'print_cart', 'add_some_message' );
function add_some_message() {
     add_meta_box( 'message_title', 'message title', 'after' );
}

这只是一个例子,不熟悉woo函数.

Its just a example, not familiar with woo functions.

谢谢.

推荐答案

感谢 gaurav kumar 我在这里找到了钩子 http://docs.woothemes.com/document/hooks/.我要找的是:

Thanks for gaurav kumar I found the hook here http://docs.woothemes.com/document/hooks/. What i was looking for was:

my_function(){
     // my code to add after cart
}
add_action('woocommerce_after_cart_contents', 'my_function');

除了 woocommerce_after_cart_contents 之外,它们还有:woocommerce_after_cart_table、woocommerce_after_cart_totals、woocommerce_after_cart.每一个都在购物车的不同部分起作用.我正在写答案,以防有人有同样的问题.

In addition to woocommerce_after_cart_contents, their are: woocommerce_after_cart_table, woocommerce_after_cart_totals, woocommerce_after_cart. Each one acts in different part of the cart. I'm writing the answer in case someone will have the same question.

这篇关于Woocommerce 添加功能以在购物车中显示项目后运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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