繁体   English   中英

Woocommerce 在菜单中添加帐户和购物篮

[英]Woocommerce add Account and Basket in menu

最近参与了一个需要连接页面和购物车图标的项目,我在这个问题上没有发现太多。

这是激活它的方法。

首先,转到 woocommerce.php 并查找此行。

 /** * Sample implementation of the WooCommerce Mini Cart. * * You can add the WooCommerce Mini Cart to header.php like so ... * *<?php * if ( function_exists( 'godault_metal_woocommerce_header_cart' ) ) { * godault_metal_woocommerce_header_cart(); * } *?> */

然后您必须取消注释,您的购物车将被激活。

要显示它,只需在 header.php 中添加相应的函数

 <div class="panier"> <?php if ( function_exists( 'godault_metal_woocommerce_header_cart' ) ) { godault_metal_woocommerce_header_cart(); } ?> </div><!--#cart -->

然后最后激活放一个链接到用户帐户做同样的事情。

转到 woocommerce.php 通过更改函数名称来添加它。

 if (! function_exists('godault_metal_woocommerce_header_account')) { /** * Display Header Account. * * @return void */ function godault_metal_woocommerce_header_account() { ?> <div class="header-my-account"> <div class="header-login"> <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" title="Account"> <i class="fas fa-user"></i> </a> </div> </div> <?php } }

将其添加到 header.php 中。

 <div class="account"> <?php if ( function_exists('godault_metal_woocommerce_header_account')) { godault_metal_woocommerce_header_account(); } ?> </div><!--#account -->

暂无
暂无

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

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