Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

"Add to cart" reference in WooCommerce mini cart WordPress

  • SOLVED

I am currently turning WooCommerce into a quoting system and looking to replace the word "cart" in the mini cart located in the websites navigation. The site is using WooThemes Shelflife theme as a parent theme. See following link http://www.crystalchandeliers.co.za and attached screenshot for more info.

I have located the mini cart in the header.php. See below.


<?php if( is_woocommerce_activated() ) { ?>
<ul class="mini-cart nav">
<li>
<a href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" title="<?php esc_attr_e('View your shopping cart', 'woothemes'); ?>" class="cart-parent">
<span>
<?php
echo sprintf(_n('<mark>%d item</mark>', '<mark>%d items</mark>', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count);
echo $woocommerce->cart->get_cart_total();
?>
</span>
</a>
<?php

echo '<ul class="cart_list">';
echo '<li class="cart-title"><h3>'.__('Your Cart Contents', 'woothemes').'</h3></li>';
if (sizeof($woocommerce->cart->cart_contents)>0) : foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) :
$_product = $cart_item['data'];
if ($_product->exists() && $cart_item['quantity']>0) :
echo '<li class="cart_list_product"><a href="' . esc_url( get_permalink( intval( $cart_item['product_id'] ) ) ) . '">';

echo $_product->get_image();

echo apply_filters( 'woocommerce_cart_widget_product_title', $_product->get_title(), $_product ) . '</a>';

if($_product instanceof woocommerce_product_variation && is_array($cart_item['variation'])) :
echo woocommerce_get_formatted_variation( $cart_item['variation'] );
endif;

echo '<span class="quantity">' . $cart_item['quantity'] . ' &times; ' . woocommerce_price( $_product->get_price() ) . '</span></li>';
endif;
endforeach;

else: echo '<li class="empty">' . __( 'No products in the cart.', 'woothemes' ) . '</li>'; endif;
if ( sizeof( $woocommerce->cart->cart_contents ) > 0 ) :
echo '<li class="total"><strong>';

if ( get_option( 'js_prices_include_tax' ) == 'yes' ) :
_e( 'Total', 'woothemes' );
else :
_e( 'Subtotal', 'woothemes' );
endif;



echo ':</strong>' . $woocommerce->cart->get_cart_total() . '</li>';

echo '<li class="buttons"><a href="' . esc_url( $woocommerce->cart->get_cart_url() ) . '" class="button">' . __( 'View Cart &rarr;', 'woothemes' ) . '</a> <a href="' . esc_url( $woocommerce->cart->get_checkout_url() ) . '" class="button checkout">' . __( 'Checkout &rarr;', 'woothemes' ) . '</a></li>';
endif;

echo '</ul>';

?>
</li>
</ul>
<?php } ?>


I have tried to replace the references to quote but doesn't seem to work. Please note that I have created a child theme for this and pulled the header.php file into the theme.

I look forward to hearing your suggestions.

Thanks
Ryan

Answers (3)

2013-07-23

Giri answers:

Hello Ryan, Most probably its because you using any cache plugins like W3 Total cache or WP super cache plugin. Try disabling those plugins or by clearing cache


Ryan Waters comments:

Hi Giri,

Thanks for your input. However, there is no cache plugin installed on the site.

Any other ideas?

Cheers
Ryan


Giri comments:

Lets just make sure that header.php file is working.

So just add this line in the top of your header.php

<?php die('Its working'); ?>

Save it and load your front page. If you see that text "Its working". Then your header.php is working. Else your website uses different file.


Ryan Waters comments:

It's working. :-)