Merge pull request #359 from typeplus/master
Woocommerce 3.1.0 Template Compatability
This commit is contained in:
commit
447a985a04
|
@ -13,24 +13,21 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.0.0
|
||||
* @version 3.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
?>
|
||||
/**
|
||||
* @hooked wc_empty_cart_message - 10
|
||||
*/
|
||||
do_action( 'woocommerce_cart_is_empty' );
|
||||
|
||||
<p class="cart-empty">
|
||||
<?php esc_html_e( 'Your cart is currently empty.', 'understrap' ) ?>
|
||||
</p>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_is_empty' ); ?>
|
||||
|
||||
<?php if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
|
||||
if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
|
||||
<p class="return-to-shop">
|
||||
<a class="btn btn-outline-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
|
||||
<?php _e( 'Return To Shop', 'understrap' ) ?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Cart Page
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,11 +13,11 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.0.3
|
||||
* @version 3.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
@ -38,7 +38,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
<th class="product-subtotal"><?php _e( 'Total', 'understrap' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody>
|
||||
<?php do_action( 'woocommerce_before_cart_contents' ); ?>
|
||||
|
||||
<?php
|
||||
|
@ -63,60 +63,60 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-thumbnail">
|
||||
<?php
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
<td class="product-thumbnail">
|
||||
<?php
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
|
||||
if ( ! $product_permalink ) {
|
||||
echo $thumbnail;
|
||||
} else {
|
||||
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
if ( ! $product_permalink ) {
|
||||
echo $thumbnail;
|
||||
} else {
|
||||
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-name" data-title="<?php _e( 'Product', 'understrap' ); ?>">
|
||||
<?php
|
||||
if ( ! $product_permalink ) {
|
||||
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . ' ';
|
||||
} else {
|
||||
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_title() ), $cart_item, $cart_item_key );
|
||||
}
|
||||
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'understrap' ); ?>">
|
||||
<?php
|
||||
if ( ! $product_permalink ) {
|
||||
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ';
|
||||
} else {
|
||||
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key );
|
||||
}
|
||||
|
||||
// Meta data
|
||||
echo WC()->cart->get_item_data( $cart_item );
|
||||
// Meta data
|
||||
echo WC()->cart->get_item_data( $cart_item );
|
||||
|
||||
// Backorder notification
|
||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
// Backorder notification
|
||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-price" data-title="<?php _e( 'Price', 'understrap' ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
|
||||
?>
|
||||
</td>
|
||||
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'understrap' ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-quantity" data-title="<?php _e( 'Quantity', 'understrap' ); ?>">
|
||||
<?php
|
||||
if ( $_product->is_sold_individually() ) {
|
||||
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
||||
} else {
|
||||
$product_quantity = woocommerce_quantity_input( array(
|
||||
'input_name' => "cart[{$cart_item_key}][qty]",
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
|
||||
'min_value' => '0'
|
||||
), $_product, false );
|
||||
}
|
||||
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'understrap' ); ?>">
|
||||
<?php
|
||||
if ( $_product->is_sold_individually() ) {
|
||||
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
||||
} else {
|
||||
$product_quantity = woocommerce_quantity_input( array(
|
||||
'input_name' => "cart[{$cart_item_key}][qty]",
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $_product->get_max_purchase_quantity(),
|
||||
'min_value' => '0',
|
||||
), $_product, false );
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
|
||||
?>
|
||||
</td>
|
||||
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>">
|
||||
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
|
||||
?>
|
||||
|
@ -128,9 +128,9 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_contents' ); ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="6" class="actions">
|
||||
|
||||
<tr>
|
||||
<td colspan="6" class="actions">
|
||||
|
||||
<?php if ( wc_coupons_enabled() ) { ?>
|
||||
<div class="coupon">
|
||||
|
@ -141,24 +141,28 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
|
||||
<input type="submit" class="btn btn-outline-primary" name="update_cart" value="<?php esc_attr_e( 'Update Cart', 'understrap' ); ?>" />
|
||||
|
||||
<?php do_action( 'woocommerce_cart_actions' ); ?>
|
||||
<?php do_action( 'woocommerce_cart_actions' ); ?>
|
||||
|
||||
<?php wp_nonce_field( 'woocommerce-cart' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart_table' ); ?>
|
||||
<?php wp_nonce_field( 'woocommerce-cart' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php do_action( 'woocommerce_after_cart_table' ); ?>
|
||||
</form>
|
||||
|
||||
<div class="cart-collaterals">
|
||||
|
||||
<?php do_action( 'woocommerce_cart_collaterals' ); ?>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* woocommerce_cart_collaterals hook.
|
||||
*
|
||||
* @hooked woocommerce_cross_sell_display
|
||||
* @hooked woocommerce_cart_totals - 10
|
||||
*/
|
||||
do_action( 'woocommerce_cart_collaterals' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart' ); ?>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
do_action( 'woocommerce_before_mini_cart' ); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_before_mini_cart' ); ?>
|
||||
|
||||
<ul class="cart_list product_list_widget <?php echo $args['list_class']; ?>">
|
||||
|
||||
<?php if ( ! WC()->cart->is_empty() ) : ?>
|
||||
<?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">×</a>',
|
||||
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">×</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; ?>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Single Product Thumbnails
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.0.2
|
||||
* @version 3.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -28,10 +28,9 @@ if ( $attachment_ids && has_post_thumbnail() ) {
|
|||
foreach ( $attachment_ids as $attachment_id ) {
|
||||
$full_size_image = wp_get_attachment_image_src( $attachment_id, 'full' );
|
||||
$thumbnail = wp_get_attachment_image_src( $attachment_id, 'shop_thumbnail' );
|
||||
$image_title = get_post_field( 'post_excerpt', $attachment_id );
|
||||
|
||||
$attributes = array(
|
||||
'title' => $image_title,
|
||||
$attributes = array(
|
||||
'title' => get_post_field( 'post_title', $attachment_id ),
|
||||
'data-caption' => get_post_field( 'post_excerpt', $attachment_id ),
|
||||
'data-src' => $full_size_image[0],
|
||||
'data-large_image' => $full_size_image[0],
|
||||
'data-large_image_width' => $full_size_image[1],
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.3.2
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
global $product;
|
||||
|
||||
if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) {
|
||||
if ( 'no' === get_option( 'woocommerce_enable_review_rating' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,9 @@ $average = $product->get_average_rating();
|
|||
|
||||
if ( $rating_count > 0 ) : ?>
|
||||
|
||||
<div class="woocommerce-product-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
|
||||
<div class="star-rating text-primary" title="<?php printf( __( 'Rated %s out of 5', 'understrap' ), $average ); ?>">
|
||||
<span style="width:<?php echo ( ( $average / 5 ) * 100 ); ?>%">
|
||||
<strong itemprop="ratingValue" class="rating"><?php echo esc_html( $average ); ?></strong> <?php printf( __( 'out of %s5%s', 'understrap' ), '<span itemprop="bestRating">', '</span>' ); ?>
|
||||
<?php printf( _n( 'based on %s customer rating', 'based on %s customer ratings', $rating_count, 'understrap' ), '<span itemprop="ratingCount" class="rating">' . $rating_count . '</span>' ); ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php if ( comments_open() ) : ?><a href="#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'understrap' ), '<span itemprop="reviewCount" class="count">' . $review_count . '</span>' ); ?>)</a><?php endif ?>
|
||||
<div class="woocommerce-product-rating">
|
||||
<?php echo wc_get_rating_html( $average, $rating_count ); ?>
|
||||
<?php if ( comments_open() ) : ?><a href="#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'understrap' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)</a><?php endif ?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* The template to display the reviewers star rating in reviews
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/review-rating.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.0.0
|
||||
* @version 3.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -23,13 +23,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
global $comment;
|
||||
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
|
||||
|
||||
if ( $rating && get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { ?>
|
||||
|
||||
<div class="star-rating">
|
||||
<span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><?php
|
||||
/* translators: %s: rating */
|
||||
printf( esc_html__( '%s out of 5', 'understrap' ), '<strong>' . $rating . '</strong>' );
|
||||
?></span>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
if ( $rating && 'yes' === get_option( 'woocommerce_enable_review_rating' ) ) {
|
||||
echo wc_get_rating_html( $rating );
|
||||
}
|
||||
|
|
Reference in New Issue