[英]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.