Change cart text - by Tiina - on WordPress WooCommerce support

This topic has 7 replies, 2 voices, and was last updated 6 years, 5 months ago ago by Rose Tyler

  • Avatar: tipadei
    Tiina
    Participant
    November 8, 2017 at 11:51

    I’m trying to rebuild my site, and wish to change the text “Cart 0 items for 0 €” into just product amount in cart, so basically just “0”.

    There is an old conversation about the topic, but I think the code has changed after that:
    https://www.8theme.com/topic/change-cart-0-items-for-0e-into-0/

    I added the css but the woo.php code has changed so much that the codes _e(‘ items for’, ETHEME_DOMAIN); and <?php etheme_cart_totals(); ?> are not written like that anymore.

    What is the part of I should remove now?

    6 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    November 8, 2017 at 13:45

    Hello,

    Do you want such result https://gyazo.com/d9770f6faf076acfc029a10b9dd8c408 ?

    Regards

    Avatar: tipadei
    Tiina
    Participant
    November 8, 2017 at 14:53

    I would rather have the product amount, instead of total sum. So if they would have five products in the cart it would show (5)

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    November 8, 2017 at 15:07

    Like on screenshot – https://prnt.sc/h7sogo ?

    Regards

    Avatar: tipadei
    Tiina
    Participant
    November 8, 2017 at 15:24

    yes

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    November 8, 2017 at 15:26

    Hello,

    In this case, add this code

    function et_cart_summ() {
        global $woocommerce;
        ?>
    		<a href="<?php echo wc_get_cart_url(); ?>" class="cart-summ" data-items-count="<?php echo WC()->cart->get_cart_contents_count(); ?>">
    			<div class="cart-bag">
    				<?php echo wp_kses_data( sprintf( '<span class="badge-number">(%1$u) %2$s</span>', WC()->cart->get_cart_contents_count(), _nx( '', '', WC()->cart->get_cart_contents_count(), 'top cart items count text', ETHEME_DOMAIN ) ) );?>
    			</div>
    		</a>
        <?php
    }

    in function.php file of child theme.

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    November 8, 2017 at 15:29

    Then clear cache and try to add some product to cart.

    Regards

  • Viewing 7 results - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.