Woocommerce添加功能,以便在购物车中显示商品后运行

时间:2015-01-07 02:24:09

标签: php wordpress woocommerce

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

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

它只是一个例子,不熟悉woo函数。

感谢。

1 个答案:

答案 0 :(得分:2)

感谢gaurav kumar我在这里发现了http://docs.woothemes.com/document/hooks/。 我在寻找的是:

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。每个人都在购物车的不同部分。 如果有人会有同样的问题,我会写下答案。