![](/img/trans.png)
[英]Add Extra button under Add to cart on shop page of Woocommerce 3
[英]Woocommerce - adding link under add to cart button
下午好,
我整個上午都在搜索互聯網,試圖找到一個產品頁面上“添加到購物車”按鈕下的“查看購物車”鏈接。
我正在嘗試執行此操作,因為我只希望在購物車中有物品時可以看到指向購物車的鏈接,而無需將其添加到主站點菜單中。
我嘗試了此代碼段,但沒有執行任何操作:
add_action( 'woocommerce_after_single_product_summary', 'add_cart_link', 0 );
function add_custom_field() {
global $post;
echo "something here";
return true;
}
我不確定最好的解決方案是什么...是否有人遇到了可行的解決方案?
將以下代碼添加到主題的functions.php
。
add_action('woocommerce_after_add_to_cart_button','view_cart_text');
function view_cart_text(){
echo '<button type="submit" class="single_add_to_cart_button button alt">View cart</button>';
}
顯然,您需要根據主題進行一些CSS或樣式設置,但這將為您提供想要實現的結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.