Answer the question
In order to leave comments, you need to log in
How to correctly display product removal as an icon in Woocommerce?
The situation is this. On the PC, I just have a link "Delete product", on the phone there is a cross icon. Everything is done, everything works. But since the main output is hidden on PC via css:
<?php
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'woocommerce_cart_item_remove_link',
sprintf(
'<a class="h-text-mob" href="%s" id="remove-from-cart" aria-label="%s" data-product_id="%s" data-product_sku="%s">%s</a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
esc_html__( 'Убрать из корзины', 'woocommerce' ),
esc_attr( $product_id ),
esc_attr( $_product->get_sku() ),
esc_html__( 'Убрать из корзины', 'woocommerce' )
),
$cart_item_key
);
?>
if ($(window).width() < 767) {
jQuery('.push-name').after(' <?php echo apply_filters(
'woocommerce_cart_item_remove_link',
sprintf(
'<a class="h-text-mob" href="%s" id="remove-from-cart" aria-label="%s" data-product_id="%s" data-product_sku="%s"><i class="far fa-times-circle"></i></a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
esc_html__( 'Убрать из корзины', 'woocommerce' ),
esc_attr( $product_id ),
esc_attr( $_product->get_sku() ),
esc_html__( 'Убрать из корзины', 'woocommerce' )
),
$cart_item_key
);
?>');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question