Skip to content

Commit

Permalink
Merge pull request #525 from bootscore/Update-WC-7.9-templates
Browse files Browse the repository at this point in the history
Update WooCommerce 7.9 templates
  • Loading branch information
justinkruit committed Jul 8, 2023
2 parents 3eb3da0 + c31c762 commit 59d97a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
24 changes: 9 additions & 15 deletions woocommerce/cart/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 7.8.0
* @version 7.9.0
*/

defined('ABSPATH') || exit;
Expand Down Expand Up @@ -45,7 +45,10 @@
* Filter the product name.
*
* @since 7.8.0
* @since 2.1.0
* @param string $product_name Name of the product in the cart.
* @param array $cart_item The product in the cart.
* @param string $cart_item_key Key for the product in the cart.
*/
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );

Expand All @@ -62,7 +65,7 @@
'<a href="%s" class="text-danger" aria-label="%s" data-product_id="%s" data-product_sku="%s"><i class="fa-regular fa-trash-can"></i></a>',
esc_url(wc_get_cart_remove_url($cart_item_key)),
/* translators: %s is the product name */
esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), $product_name ) ),
esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), wp_strip_all_tags( $product_name ) ) ),
esc_attr($product_id),
esc_attr($_product->get_sku())
),
Expand All @@ -86,23 +89,14 @@
<td class="product-name" data-title="<?php esc_attr_e('Product', 'woocommerce'); ?>">
<?php
if (!$product_permalink) {
/**
* Filter the product name.
*
* @since 7.8.0
* @param string $product_name Name of the product in the cart.
* @param array $cart_item The product in the cart.
* @param string $cart_item_key Key for the product in the cart.
*/
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $product_name, $cart_item, $cart_item_key ) . '&nbsp;' );
echo wp_kses_post( $product_name . '&nbsp;' );
} else {
/**
* Filter the product name.
* This filter is documented above.
*
* @since 7.8.0
* @param string $product_url URL the product in the cart.
* @since 2.1.0
*/
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $product_name ), $cart_item, $cart_item_key ) );
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
}

do_action('woocommerce_after_cart_item_name', $cart_item, $cart_item_key);
Expand Down
8 changes: 4 additions & 4 deletions woocommerce/cart/mini-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 7.8.0
* @version 7.9.0
*/

defined('ABSPATH') || exit;
Expand All @@ -34,9 +34,9 @@

if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key)) {
/**
* Filter the product name.
* This filter is documented in woocommerce/templates/cart/cart.php.
*
* @param string $product_name Name of the product in the cart.
@since 2.1.0
*/
$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);
Expand Down Expand Up @@ -84,7 +84,7 @@
'<a href="%s" class="remove_from_cart_button text-danger" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"><i class="fa-regular fa-trash-can"></i></a>',
esc_url(wc_get_cart_remove_url($cart_item_key)),
/* translators: %s is the product name */
esc_attr(sprintf(__('Remove %s from cart', 'woocommerce'), $product_name)),
esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), wp_strip_all_tags( $product_name ) ) ),
esc_attr($product_id),
esc_attr($cart_item_key),
esc_attr($_product->get_sku())
Expand Down

0 comments on commit 59d97a8

Please sign in to comment.