[英]Woocommerce add Account and Basket in menu
最近参与了一个需要连接页面和购物车图标的项目,我在这个问题上没有发现太多。
Here is how to activate it.这是激活它的方法。
First, go to woocommerce.php and look for this line.首先,转到 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(); * } *?> */
Then you must uncomment it and your cart will be activated.然后您必须取消注释,您的购物车将被激活。
To display it, just add your corresponding function in your header.php要显示它,只需在 header.php 中添加相应的函数
<div class="panier"> <?php if ( function_exists( 'godault_metal_woocommerce_header_cart' ) ) { godault_metal_woocommerce_header_cart(); } ?> </div><!--#cart -->
Then finally to activate put a link to the user account do the same.然后最后激活放一个链接到用户帐户做同样的事情。
Go to woocommerce.php add this by changing the name of the function.转到 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 } }
Add it in the header.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.