Skip to content

Instantly share code, notes, and snippets.

@MindyPostoff
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MindyPostoff/dd0662dccd8068035757 to your computer and use it in GitHub Desktop.
Save MindyPostoff/dd0662dccd8068035757 to your computer and use it in GitHub Desktop.
Mini-Cart in PixelPress
<?php if ( is_woocommerce_activated() ) { ?>
<ul class="mini-cart">
<li>
<a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>" class="cart-parent">
<span>
<?php
echo $woocommerce->cart->get_cart_total();;
echo sprintf(_n('<mark>%d</mark>', '<mark>%d</mark>', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
?>
</span>
</a>
<?php
echo '<ul class="cart_list">';
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="'.get_permalink($cart_item['product_id']).'">';
echo $_product->get_image();
echo '</a>';
if($_product instanceof woocommerce_product_variation && is_array($cart_item['variation'])) :
echo woocommerce_get_formatted_variation( $cart_item['variation'] );
endif;
echo '<span class="details quantity"><a href="'.get_permalink($cart_item['product_id']).'">'.apply_filters('woocommerce_cart_widget_product_title', $_product->get_title(), $_product).'</a>' .$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="'.$woocommerce->cart->get_cart_url().'" class="button">'.__('View Cart &rarr;','woothemes').'</a> <a href="'.$woocommerce->cart->get_checkout_url().'" class="button checkout">'.__('Checkout &rarr;','woothemes').'</a></li>';
endif;
echo '</ul>';
?>
</li>
</ul>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment