![](/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.