Avada Forums Community Forum Woocommerce – Cart: How to remove heading: "You Have X Items In Your Cart"?

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • mads sonne
    Participant
    Post count: 5

    Hi,

    How do I remove the heading in the woocommerce cart – the one, that reads “You Have X Items In Your Cart”?
    I can’t seem to find anywhere in the file structure or woocommerce filters.

    mads sonne
    Participant
    Post count: 5

    I have found out that in: \wp-content\themes\avada\includes\class-avada-woocommerce.php
    – around line 1164 you’ll find:

    /**
    * Add markup before the cart table.
    *
    * @access public
    * @since 5.1.0
    * @param array $args Not really used here.
    */
    public function before_cart_table( $args ) {
    global $woocommerce;
    ?>
    <div class=”woocommerce-content-box full-width clearfix”>
    <?php /* translators: Number. */ ?>
    <h2><?php printf( esc_attr( _n( ‘You Have %d Item In Your Cart’, ‘You Have %d Items In Your Cart’, $woocommerce->cart->get_cart_contents_count(), ‘Avada’ ) ), number_format_i18n( $woocommerce->cart->get_cart_contents_count() ) ); // WPCS: XSS ok. ?></h2>
    <?php
    }

    This is the only place, where I can find the wording. But I don’t know which filter/function activates it or how to disable it.

    pawel-piotrowski
    Participant
    Post count: 1

    Hi,

    I came across similar problem. I had to translate this sentence into multiple languages using WPML. The thing is in WPML you cannot translate this one, at least I couldn’t find a way. Thanks to your finding about the location of the file (class-avada-woocommerce.php) I was able to add a little bit of code to do the translation:

    <h2><?php
    if (ICL_LANGUAGE_CODE == “en”)
    printf( esc_attr( _n( ‘You Have %d Item In Your Cart’, ‘You Have %s Items In Your Cart’, $woocommerce->cart->get_cart_contents_count(), ‘Avada’ ) ), number_format_i18n( $woocommerce->cart->get_cart_contents_count() ) ); // WPCS: XSS ok.

    else if (ICL_LANGUAGE_CODE == “de”)
    printf( esc_attr( _n( ‘Sie haben %d Artikel in Ihrem Warenkorb’, ‘Sie haben %s Artikel in Ihrem Warenkorb’, $woocommerce->cart->get_cart_contents_count(), ‘Avada’ ) ), number_format_i18n( $woocommerce->cart->get_cart_contents_count() ) ); // WPCS: XSS ok.

    else printf( esc_attr( _n( ‘You Have %d Item In Your Cart’, ‘You Have %s Items In Your Cart’, $woocommerce->cart->get_cart_contents_count(), ‘Avada’ ) ), number_format_i18n( $woocommerce->cart->get_cart_contents_count() ) ); // WPCS: XSS ok.
    ?></h2>

    In order to remove this text entirely you just need to get rid of this:

    <h2><?php printf( esc_attr( _n( ‘You Have %d Item In Your Cart’, ‘You Have %d Items In Your Cart’, $woocommerce->cart->get_cart_contents_count(), ‘Avada’ ) ), number_format_i18n( $woocommerce->cart->get_cart_contents_count() ) ); // WPCS: XSS ok. ?></h2>

    Regards,

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.