title: How to show woocommerce shopping cart with php but customize it by adding an icon and changing the text
body: <p>please help me, I want to show a woocommerce shopping cart with customized text and icon on my wordpress website. I am using this source code for reference: <a href="https://docs.woocommerce.com/document/show-cart-contents-total/" rel="nofollow noreferrer">https://docs.woocommerce.com/document/show-cart-contents-total/</a></p>
  <p>I am showing it on the frontend, it looks like this with the source code from the link above, but I would like to show it with a  icon inside the  and I would also like to change the text, to be 'products' instead of 'items'</p>
  <p><a href="https://i.stack.imgur.com/JZDoj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JZDoj.png" alt="enter image description here" /></a></p>
  <p>Here is my code of trying to show that icon and the changed text, please help me:</p>
  <pre><code>&lt;a class=&quot;cart-customlocation&quot; href=&quot;&lt;?php echo wc_get_cart_url(); ?&gt;&quot; title=&quot;&lt;?php _e( 'View your shopping cart' ); ?&gt;&quot;&gt;
  &lt;?php echo sprintf ( _n( '&lt;i class=&quot;fa fa-cart&quot;&gt;&lt;/i&gt;Cart  %d product', '&lt;i class=&quot;fa fa-cart&quot;&gt;&lt;/i&gt;Cart  %d products s', WC()-&gt;cart-&gt;get_cart_contents_count() ), WC()-&gt;cart-&gt;get_cart_contents_count() ); ?&gt; - &lt;?php echo WC()-&gt;cart-&gt;get_cart_total(); ?&gt;&lt;/a&gt;
  </code></pre>
  <p>Code in functions.php:</p>
  <pre><code>add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' 
   );
  
  function woocommerce_header_add_to_cart_fragment( $fragments ) {
  global $woocommerce;
  
  ob_start();
  
  ?&gt;
  &lt;a class=&quot;cart-customlocation&quot; href=&quot;&lt;?php echo esc_url(wc_get_cart_url()); ?&gt;&quot; title=&quot;&lt;?php _e('View your shopping cart', 'woothemes'); ?&gt;&quot;&gt;&lt;?php echo sprintf(_n('%d item', '%d items', $woocommerce-&gt;cart-&gt;cart_contents_count, 'woothemes'), $woocommerce-&gt;cart-&gt;cart_contents_count);?&gt; - &lt;?php echo $woocommerce-&gt;cart-&gt;get_cart_total(); ?&gt;&lt;/a&gt;
  &lt;?php
  $fragments['a.cart-customlocation'] = ob_get_clean();
  return $fragments; }
  </code></pre>