如何在店面主题 woocommerce 的 header 购物车中的价格前添加自定义文本

How to add custom text before the price in the header cart in Storefront theme woocommerce

我想在店面主题的 header 购物车中的定价前添加文本 "Your Cart: ",我尝试编辑并将其添加到 inc/woocommerce/storefront-woocommerce-template-functions.php 行72 英寸

 <?php
function storefront_cart_link() {
<span class="amount">ADDED HERE<?php echo "AND HERE ALSO" . wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> 
}?>

尽管在网站加载之前它一直显示在前端,但当加载完成时,文本就消失了。 请建议如何去做。

运行 WP v4.6

它会显示您的购物车 如果您将它添加到锚标记之外,如下所示。

function storefront_cart_link() {
        ?>
            <span style="float:left;">Your Cart :</span> 
            <a class="cart-contents" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>">
                <span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
            </a>
        <?php
    }