Created
December 6, 2013 14:25
-
-
Save dompascal/7825493 to your computer and use it in GitHub Desktop.
Woocommerce - Shopping Bag Widget/Dropdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- shopping bag widget/dropdown --> | |
<div class="shopping-bag"> | |
<div class="my-shopping-bag"> | |
<?php global $woocommerce; ?> | |
<a class="shopping-bag-link" href="<?php echo $woocommerce->cart->get_cart_url(); ?>"><span class="total">(<?php echo sprintf(_n('%d item', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?>)</span></a> | |
</div> <!-- // .my-shopping-bag --> | |
<?php if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) : ?> | |
<div class="dropdown"> | |
<div class="items"> | |
<ul> | |
<?php $woocommerce->cart->cart_contents = array_reverse($woocommerce->cart->cart_contents); ?> | |
<?php foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) : | |
$_product = $values['data']; | |
if ( $_product->exists() && $values['quantity'] > 0 ) : | |
$product_quantity = esc_attr( $values['quantity'] ); | |
$product_price = (( get_option('woocommerce_display_cart_prices_excluding_tax') == 'yes' ) ? $_product->get_price_excluding_tax() : $_product->get_price()) * $product_quantity; | |
//echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key ); | |
?> | |
<li> | |
<!-- thumb --> | |
<span class="shop-bag-thumb"> | |
<a href="<?php echo esc_url( get_permalink( apply_filters('woocommerce_in_cart_product_id', $values['product_id'] ) ) ); ?>" class="clearfix"> | |
<?php echo $_product->get_image('zoom-thumb'); ?> | |
</a> | |
</span> | |
<!-- end thumb --> | |
<!-- details --> | |
<span class="details"> | |
<span class="title"><?php echo $_product->get_title(); ?></span><br> | |
<span class="qty">Qty: <?php echo $product_quantity; ?></span> | |
</span> | |
<!-- end details --> | |
<!-- price --> | |
<?php echo apply_filters('woocommerce_cart_item_price_html', woocommerce_price( $product_price ), $values, $cart_item_key ); ?> | |
<!-- end price --> | |
<!-- | |
<div class="remove"> | |
<?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" title="%s">×</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove from cart', 'woocommerce') ), $cart_item_key ); | |
?> | |
</div> | |
--> | |
</li> | |
<?php endif; endforeach; ?> | |
</ul> | |
</div> | |
<!-- end items --> | |
<!-- sub total --> | |
<div class="subtotal"> | |
<span class="text">Subtotal</span><span class="total"><?php echo $woocommerce->cart->get_cart_total(); ?></span> | |
</div> | |
<!-- end sub total --> | |
<a href="<?php echo home_url( '/' ); ?>shopping-bag/" class="go-to-checkout">Checkout</a> | |
</div> | |
<!-- end dropdown --> | |
<?php endif; ?> | |
</div> <!-- // .shopping-bag --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment