Woocommerce 3.1.0 Compatability

This commit is contained in:
Jason King 2017-06-29 22:13:34 +09:30 committed by GitHub
parent 870e184c7b
commit ce97bab35a
1 changed files with 19 additions and 27 deletions

View File

@ -15,36 +15,34 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
* @version 3.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
?>
<?php do_action( 'woocommerce_before_mini_cart' ); ?>
<ul class="cart_list product_list_widget <?php echo $args['list_class']; ?>">
do_action( 'woocommerce_before_mini_cart' ); ?>
<?php if ( ! WC()->cart->is_empty() ) : ?>
<ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">
<?php
do_action( 'woocommerce_before_mini_cart_contents' );
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key );
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
$product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
?>
<li class="<?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>">
<li class="woocommerce-mini-cart-item <?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>">
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
'<a href="%s" class="remove" title="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
esc_attr__( 'Remove this item', 'understrap' ),
esc_attr( $product_id ),
@ -65,26 +63,20 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php
}
}
do_action( 'woocommerce_mini_cart_contents' );
?>
</ul>
<?php else : ?>
<li class="empty"><?php _e( 'No products in the cart.', 'understrap' ); ?></li>
<?php endif; ?>
</ul><!-- end product list -->
<?php if ( ! WC()->cart->is_empty() ) : ?>
<p class="total"><strong><?php _e( 'Subtotal', 'understrap' ); ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?></p>
<p class="woocommerce-mini-cart__total total"><strong><?php _e( 'Subtotal', 'understrap' ); ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?></p>
<?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?>
<p class="buttons">
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="btn btn-outline-primary"><?php _e( 'View Cart', 'understrap' ); ?></a>
<a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="btn btn-primary"><?php _e( 'Checkout', 'understrap' ); ?></a>
</p>
<p class="woocommerce-mini-cart__buttons buttons"><?php do_action( 'woocommerce_widget_shopping_cart_buttons' ); ?></p>
<?php else : ?>
<p class="woocommerce-mini-cart__empty-message"><?php _e( 'No products in the cart.', 'understrap' ); ?></p>
<?php endif; ?>