简体   繁体   English

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

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

相关问题 WooCommerce“添加到购物篮”按钮不起作用 - WooCommerce Add To Basket button not working woocommerce在我的帐户的菜单导航上添加字幕 - woocommerce add subtitle on menu navigation on my account 如何将链接项目添加到 WooCommerce 我的帐户菜单中的另一个页面 - How to add a linked item to another page in WooCommerce My Account menu 如何替换我的帐户并在Woocommerce中添加登录/注销链接到菜单? - How to replace My Account and add login/logout links to menu in Woocommerce? 在 Woocommerce 我的帐户菜单中的注销项上方添加自定义项 - Add a custom item above logout item in Woocommerce my account menu 在 WooCommerce 中添加一个微调器以添加到购物篮和下订单按钮 - Add a spinner to Add to Basket and Place Order buttons in WooCommerce 更新购物篮/购物车页面上的购物篮自定义属性 WooCommerce 产品附加组件 - Update basket custom attribute on basket/cart page WooCommerce Product Add-ons 当 Woocommerce 中的篮子有项目时添加自定义主体类 - Add a custom body class when basket has items in Woocommerce 限制woocommerce购物篮尺寸 - Limit woocommerce basket size 在 WooCommerce 中添加基于用户角色的自定义我的帐户菜单项 3+ - Add custom my account menu item based on user role in WooCommerce 3+
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM