简体   繁体   中英

Woocommerce add Account and Basket in menu

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

Here is how to activate it.

First, go to woocommerce.php and look for this line.

 /** * 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

 <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.

 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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