繁体   English   中英

WooCommerce 购物车挂钩“woocommerce_cart_contents”显示内容错误 position

[英]WooCommerce cart hook 'woocommerce_cart_contents' displaying content in the wrong position

我正在尝试在购物车项目下方和“应用优惠券”和“更新购物车”按钮上方添加内容。

我正在使用动作挂钩woocommerce_cart_contents

add_action('woocommerce_cart_contents', 'add_content');
function add_content(){
    echo 'The content';
} 

回显的文本显示在购物车表上方。

在此处输入图像描述

我在两个不同的网站上对此进行了测试,发现了同样的问题。 知道我哪里出错了吗?

看来您使用的是正确的钩子,但由于它涉及表格行,请将其包装在<table>标记中

function add_content(){
    echo '<tr><td>The content</td></tr>';
}
add_action('woocommerce_cart_contents', 'add_content');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM