Change Woocomerce cart icon

Hello folks!

I’m trying to change the woocommerce cart icon…
Right now it’s using “x-icon-shopping-cart” icon, but i want to change to “x-icon-gift”

i already changed in woocommerce.php file located in pro\framework\functions\global\plugins\

When the page is loading, for a briefly moment you can see the icon that i choose, but almost at the same time, changes back to the original one…

Here is my website: http://klausetania.com.br/

P.S.: Sorry for my english… I’m learning!

Hi There,

Thanks for writing in! Your site is not loading.

However, try copying the following function into your child theme’s functions.php file and then change it accordingly.

function x_woocommerce_navbar_cart() {

    $cart_info   = x_get_option( 'x_woocommerce_header_cart_info' );
    $cart_layout = x_get_option( 'x_woocommerce_header_cart_layout' );
    $cart_style  = x_get_option( 'x_woocommerce_header_cart_style' );
    $cart_outer  = x_get_option( 'x_woocommerce_header_cart_content_outer' );
    $cart_inner  = x_get_option( 'x_woocommerce_header_cart_content_inner' );

    $data = array(
      'icon'  => '<i class="x-icon-shopping-cart" data-x-icon="&#xf07a;" aria-hidden="true"></i>',
      'total' => WC()->cart->get_cart_total(),
      'count' => sprintf( _n( '%d Item', '%d Items', WC()->cart->cart_contents_count, '__x__' ), WC()->cart->cart_contents_count )
    );

    $modifiers = array(
      $cart_info,
      strpos( $cart_info, '-' ) === false ? 'inline' : $cart_layout,
      $cart_style
    );

    $cart_output = '<div class="x-cart ' . implode( ' ', $modifiers ) . '">';

      foreach ( explode( '-', $cart_info ) as $info ) {
        $key = ( $info == 'outer' ) ? $cart_outer : $cart_inner;
        $cart_output .= '<span class="' . $info . '">' . $data[$key] . '</span>';
      }

    $cart_output .= '</div>';

    return $cart_output;

  }

data-x-icon code you can find from the following link (http://fontawesome.io/cheatsheet/).

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.