Created
February 19, 2022 11:21
-
-
Save tongdaitructuyen/afb2af694bcafe884997c990b91f2d98 to your computer and use it in GitHub Desktop.
Cách thêm biểu tượng loại bỏ (xóa) sản phẩm trong trang thanh toán WooCommerce >>> https://www.mycomputer.vn/cach-them-bieu-tuong-loai-bo-xoa-san-pham-vao-trang-thanh-toan-woocommerce/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add Remove button to WooCommerce checkout page - cart items | |
*/ | |
add_filter('woocommerce_cart_item_name', 'mycomputer_filter_wc_cart_item_remove_link', 10, 3); | |
function mycomputer_filter_wc_cart_item_remove_link($product_name, $cart_item, $cart_item_key) | |
{ | |
if (is_checkout()) { | |
$product_name .= apply_filters('woocommerce_cart_item_remove_link', sprintf( | |
'<a href="%s" rel="nofollow" class="remove-icon" style="float:left;">x</a>', | |
esc_url(WC_Cart::get_remove_url($cart_item_key)), | |
__('Remove this item', 'woocommerce'), | |
esc_attr($cart_item['product_id']), | |
esc_attr($cart_item['data']->get_sku()) | |
), $cart_item_key); | |
return $product_name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment