Merge pull request #1080 from noelspringer/woocommerce-3.7.0

Update Woocommerce templates for 3.7.0
This commit is contained in:
UnderstrapFramework 2019-12-16 08:09:32 +00:00 committed by GitHub
commit 782fe4a1de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 43 deletions

View File

@ -13,14 +13,11 @@
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.6.1 * @version 3.7.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
do_action( 'woocommerce_before_mini_cart' ); ?> do_action( 'woocommerce_before_mini_cart' ); ?>
@ -28,7 +25,7 @@ do_action( 'woocommerce_before_mini_cart' ); ?>
<ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>"> <ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">
<?php <?php
do_action( 'woocommerce_before_mini_cart_contents' ); do_action( 'woocommerce_before_mini_cart_contents' );
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { 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 = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
@ -42,45 +39,58 @@ do_action( 'woocommerce_before_mini_cart' ); ?>
?> ?>
<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 ) ); ?>"> <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 <?php
echo apply_filters( echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'woocommerce_cart_item_remove_link', sprintf( 'woocommerce_cart_item_remove_link',
sprintf(
'<a href="%s" class="remove remove_from_cart_button" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s">&times;</a>', '<a href="%s" class="remove remove_from_cart_button" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s">&times;</a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ), esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
__( 'Remove this item', 'understrap' ), esc_html__( 'Remove this item', 'understrap' ),
esc_attr( $product_id ), esc_attr( $product_id ),
esc_attr( $cart_item_key ), esc_attr( $cart_item_key ),
esc_attr( $_product->get_sku() ) esc_attr( $_product->get_sku() )
), $cart_item_key ),
$cart_item_key
); );
?> ?>
<?php if ( empty( $product_permalink ) ) : ?> <?php if ( empty( $product_permalink ) ) : ?>
<?php echo $thumbnail . $product_name; ?> <?php echo $thumbnail . $product_name; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?> <?php else : ?>
<a href="<?php echo esc_url( $product_permalink ); ?>"> <a href="<?php echo esc_url( $product_permalink ); ?>">
<?php echo $thumbnail . $product_name; ?> <?php echo $thumbnail . $product_name; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php echo wc_get_formatted_cart_item_data( $cart_item ); ?> <?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s &times; %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?> <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s &times; %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</li> </li>
<?php <?php
} }
} }
do_action( 'woocommerce_mini_cart_contents' ); do_action( 'woocommerce_mini_cart_contents' );
?> ?>
</ul> </ul>
<p class="woocommerce-mini-cart__total total"><strong><?php _e( 'Subtotal', 'understrap' ); ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?></p> <p class="woocommerce-mini-cart__total total">
<?php
/**
* Woocommerce_widget_shopping_cart_total hook.
*
* @hooked woocommerce_widget_shopping_cart_subtotal - 10
*/
do_action( 'woocommerce_widget_shopping_cart_total' );
?>
</p>
<?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?> <?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?>
<p class="woocommerce-mini-cart__buttons buttons"><?php do_action( 'woocommerce_widget_shopping_cart_buttons' ); ?></p> <p class="woocommerce-mini-cart__buttons buttons"><?php do_action( 'woocommerce_widget_shopping_cart_buttons' ); ?></p>
<?php do_action( 'woocommerce_widget_shopping_cart_after_buttons' ); ?>
<?php else : ?> <?php else : ?>
<p class="woocommerce-mini-cart__empty-message"><?php _e( 'No products in the cart.', 'understrap' ); ?></p> <p class="woocommerce-mini-cart__empty-message"><?php esc_html_e( 'No products in the cart.', 'understrap' ); ?></p>
<?php endif; ?> <?php endif; ?>
<?php do_action( 'woocommerce_after_mini_cart' ); <?php do_action( 'woocommerce_after_mini_cart' ); ?>

View File

@ -12,15 +12,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.6.1 * @version 3.7.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
do_action( 'woocommerce_before_account_orders', $has_orders ); ?> do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
@ -36,9 +33,10 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
</thead> </thead>
<tbody> <tbody>
<?php foreach ( $customer_orders->orders as $customer_order ) : <?php
$order = wc_get_order( $customer_order ); foreach ( $customer_orders->orders as $customer_order ) {
$item_count = $order->get_item_count(); $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$item_count = $order->get_item_count() - $order->get_item_count_refunded();
?> ?>
<tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order"> <tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order">
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?> <?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?>
@ -48,7 +46,7 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
<?php elseif ( 'order-number' === $column_id ) : ?> <?php elseif ( 'order-number' === $column_id ) : ?>
<a href="<?php echo esc_url( $order->get_view_order_url() ); ?>"> <a href="<?php echo esc_url( $order->get_view_order_url() ); ?>">
<?php echo _x( '#', 'hash before order number', 'understrap' ) . $order->get_order_number(); ?> <?php echo esc_html( _x( '#', 'hash before order number', 'understrap' ) . $order->get_order_number() ); ?>
</a> </a>
<?php elseif ( 'order-date' === $column_id ) : ?> <?php elseif ( 'order-date' === $column_id ) : ?>
@ -60,7 +58,7 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
<?php elseif ( 'order-total' === $column_id ) : ?> <?php elseif ( 'order-total' === $column_id ) : ?>
<?php <?php
/* translators: 1: formatted order total 2: total order items */ /* translators: 1: formatted order total 2: total order items */
printf( _n( '%1$s for %2$s item', '%1$s for %2$s items', $item_count, 'understrap' ), $order->get_formatted_order_total(), $item_count ); echo wp_kses_post( sprintf( _n( '%1$s for %2$s item', '%1$s for %2$s items', $item_count, 'understrap' ), $order->get_formatted_order_total(), $item_count ) );
?> ?>
<?php elseif ( 'order-actions' === $column_id ) : ?> <?php elseif ( 'order-actions' === $column_id ) : ?>
@ -68,8 +66,8 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
$actions = wc_get_account_orders_actions( $order ); $actions = wc_get_account_orders_actions( $order );
if ( ! empty( $actions ) ) { if ( ! empty( $actions ) ) {
foreach ( $actions as $key => $action ) { foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
echo '<a href="' . esc_url( $action['url'] ) . '" class="woocommerce-button button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>'; echo '<a href="' . esc_url( $action['url'] ) . '" class="woocommerce-button btn btn-outline-primary ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>';
} }
} }
?> ?>
@ -77,7 +75,9 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
</td> </td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php endforeach; ?> <?php
}
?>
</tbody> </tbody>
</table> </table>
@ -86,11 +86,11 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
<?php if ( 1 < $customer_orders->max_num_pages ) : ?> <?php if ( 1 < $customer_orders->max_num_pages ) : ?>
<div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination"> <div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination">
<?php if ( 1 !== $current_page ) : ?> <?php if ( 1 !== $current_page ) : ?>
<a class="woocommerce-button woocommerce-button--previous woocommerce-Button woocommerce-Button--previous button" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page - 1 ) ); ?>"><?php _e( 'Previous', 'understrap' ); ?></a> <a class="woocommerce-button woocommerce-button--previous woocommerce-Button woocommerce-Button--previous btn btn-outline-primary" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page - 1 ) ); ?>"><?php esc_html_e( 'Previous', 'understrap' ); ?></a>
<?php endif; ?> <?php endif; ?>
<?php if ( intval( $customer_orders->max_num_pages ) !== $current_page ) : ?> <?php if ( intval( $customer_orders->max_num_pages ) !== $current_page ) : ?>
<a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next btn btn-outline-primary" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page + 1 ) ); ?>"><?php _e( 'Next', 'understrap' ); ?></a> <a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next btn btn-outline-primary" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page + 1 ) ); ?>"><?php esc_html_e( 'Next', 'understrap' ); ?></a>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -98,10 +98,10 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
<?php else : ?> <?php else : ?>
<div class="woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info"> <div class="woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info">
<a class="btn btn-outline-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( '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( 'Go shop', 'understrap' ) ?> <?php esc_html_e( 'Go to the shop', 'understrap' ); ?>
</a> </a>
<?php _e( 'No order has been made yet.', 'understrap' ); ?> <?php esc_html_e( 'No order has been made yet.', 'understrap' ); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php do_action( 'woocommerce_after_account_orders', $has_orders ); <?php do_action( 'woocommerce_after_account_orders', $has_orders ); ?>