Woocommerce-标头购物车图标自定义

时间:2019-02-14 12:00:17

标签: php woocommerce

我第一次创建自定义Woocommrce主题。我需要在标题中显示购物车链接的帮助。看起来像这样https://imgur.com/AjARqhX,需要像这样https://imgur.com/QvYUPgU

这是我的代码

function woocommerce_header_add_to_cart_fragment( $fragments ) {
    global $woocommerce;

    ob_start();

    ?>
    <a class="cart-customlocation" href="<?php echo esc_url(wc_get_cart_url()); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?>
        <img class="immm" src="<?php echo home_url(); ?>/wp-content/uploads/icons/header/cart.png">
        <span><?php _e('Košík',''); ?></span>       
    </a>
    <?php
    $fragments['a.cart-customlocation'] = ob_get_clean();
    return $fragments;
}

现在,我需要在“绿色气泡”中显示已添加到购物车中的产品数量,并删除单词“ item”。

在单击向下箭头图标后,它还会显示一个微型购物车。可以帮忙吗?

非常感谢。

0 个答案:

没有答案