Merge pull request #1055 from noelspringer/woocommerce-3.8.0

Update Woocommerce cart template for WC 3.8.0
This commit is contained in:
UnderstrapFramework 2019-12-13 11:15:03 +00:00 committed by GitHub
commit 28b8e76175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 19 deletions

View File

@ -12,7 +12,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.6.1
* @version 3.8.0
*/
defined( 'ABSPATH' ) || exit;
@ -30,7 +30,7 @@ do_action( 'woocommerce_before_cart' ); ?>
<th class="product-name"><?php esc_html_e( 'Product', 'understrap' ); ?></th>
<th class="product-price"><?php esc_html_e( 'Price', 'understrap' ); ?></th>
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'understrap' ); ?></th>
<th class="product-subtotal"><?php esc_html_e( 'Total', 'understrap' ); ?></th>
<th class="product-subtotal"><?php esc_html_e( 'Subtotal', 'understrap' ); ?></th>
</tr>
</thead>
<tbody>
@ -48,14 +48,17 @@ do_action( 'woocommerce_before_cart' ); ?>
<td class="product-remove">
<?php
// @codingStandardsIgnoreLine
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'woocommerce_cart_item_remove_link',
sprintf(
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
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->get_sku() )
), $cart_item_key );
),
$cart_item_key
);
?>
</td>
@ -102,20 +105,24 @@ do_action( 'woocommerce_before_cart' ); ?>
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(
$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_name' => $_product->get_name(),
), $_product, false );
),
$_product,
false
);
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?>
</td>
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>">
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Subtotal', 'understrap' ); ?>">
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
?>
@ -152,6 +159,8 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
</form>
<?php do_action( 'woocommerce_before_cart_collaterals' ); ?>
<div class="cart-collaterals">
<?php
/**
@ -164,4 +173,4 @@ do_action( 'woocommerce_before_cart' ); ?>
?>
</div>
<?php do_action( 'woocommerce_after_cart' );
<?php do_action( 'woocommerce_after_cart' ); ?>