簡體   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