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/ * @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.6.1 * @version 3.8.0
*/ */
defined( 'ABSPATH' ) || exit; 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-name"><?php esc_html_e( 'Product', 'understrap' ); ?></th>
<th class="product-price"><?php esc_html_e( 'Price', '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-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> </tr>
</thead> </thead>
<tbody> <tbody>
@ -48,14 +48,17 @@ do_action( 'woocommerce_before_cart' ); ?>
<td class="product-remove"> <td class="product-remove">
<?php <?php
// @codingStandardsIgnoreLine echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( 'woocommerce_cart_item_remove_link',
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>', sprintf(
esc_url( wc_get_cart_remove_url( $cart_item_key ) ), '<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
__( 'Remove this item', 'understrap' ), esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
esc_attr( $product_id ), esc_html__( 'Remove this item', 'understrap' ),
esc_attr( $_product->get_sku() ) esc_attr( $product_id ),
), $cart_item_key ); esc_attr( $_product->get_sku() )
),
$cart_item_key
);
?> ?>
</td> </td>
@ -102,20 +105,24 @@ do_action( 'woocommerce_before_cart' ); ?>
if ( $_product->is_sold_individually() ) { if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key ); $product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else { } else {
$product_quantity = woocommerce_quantity_input( array( $product_quantity = woocommerce_quantity_input(
'input_name' => "cart[{$cart_item_key}][qty]", array(
'input_value' => $cart_item['quantity'], 'input_name' => "cart[{$cart_item_key}][qty]",
'max_value' => $_product->get_max_purchase_quantity(), 'input_value' => $cart_item['quantity'],
'min_value' => '0', 'max_value' => $_product->get_max_purchase_quantity(),
'product_name' => $_product->get_name(), 'min_value' => '0',
), $_product, false ); 'product_name' => $_product->get_name(),
),
$_product,
false
);
} }
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok. echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?> ?>
</td> </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 <?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. 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' ); ?> <?php do_action( 'woocommerce_after_cart_table' ); ?>
</form> </form>
<?php do_action( 'woocommerce_before_cart_collaterals' ); ?>
<div class="cart-collaterals"> <div class="cart-collaterals">
<?php <?php
/** /**
@ -164,4 +173,4 @@ do_action( 'woocommerce_before_cart' ); ?>
?> ?>
</div> </div>
<?php do_action( 'woocommerce_after_cart' ); <?php do_action( 'woocommerce_after_cart' ); ?>