woocommerce_cart_item_remove_link
Использование
add_filter( 'woocommerce_cart_item_remove_link', 'wp_kama_woocommerce_cart_item_remove_link_filter', 10, 2 ); /** * Function for `woocommerce_cart_item_remove_link` filter-hook. * * @param $sprintf * @param $cart_item_key * * @return */ function wp_kama_woocommerce_cart_item_remove_link_filter( $sprintf, $cart_item_key ){ // filter... return $sprintf; }
- $sprintf
- -
- $cart_item_key
- -
Где вызывается хук
В файле: /templates/cart/cart.php
woocommerce_cart_item_remove_link
woocommerce/templates/cart/cart.php 60-71
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">×</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' ), wp_strip_all_tags( $product_name ) ) ), esc_attr( $product_id ), esc_attr( $_product->get_sku() ) ), $cart_item_key );
woocommerce/templates/cart/mini-cart.php 47-61
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped '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" data-success_message="%s">×</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' ), wp_strip_all_tags( $product_name ) ) ), esc_attr( $product_id ), esc_attr( $cart_item_key ), esc_attr( $_product->get_sku() ), /* translators: %s is the product name */ esc_attr( sprintf( __( '“%s” has been removed from your cart', 'woocommerce' ), wp_strip_all_tags( $product_name ) ) ) ), $cart_item_key );