Created
April 11, 2021 13:28
-
-
Save cpaul007/c2d537b224d5e4af8cb8bdc5da441815 to your computer and use it in GitHub Desktop.
How to add custom remove icon in Menu/Ultimate Cart
This file contains hidden or 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
<?php //* Don't add this line | |
add_action( 'woocommerce_before_mini_cart_contents', 'ouwoo_custom_remove_icon', 11 ); | |
function ouwoo_custom_remove_icon() { | |
remove_filter( 'woocommerce_cart_item_remove_link', 'ouwoo_woo_cart_remove_button', 10, 2 ); | |
add_filter( 'woocommerce_cart_item_remove_link', 'ouwoo_add_custom_remove_button_icon', 10, 2 ); | |
} | |
function ouwoo_add_custom_remove_button_icon($remove_link, $cart_item_key ) { | |
$svgFile = 'ADD YOUR SVG HTML CODE OR IMG HTML CODE HERE'; | |
$remove_link = str_replace( '×', $svgFile, $remove_link ); | |
return $remove_link; | |
} | |
add_action( 'woocommerce_after_mini_cart', function() { | |
remove_filter( 'woocommerce_cart_item_remove_link', 'ouwoo_add_custom_remove_button_icon', 10, 2 ); | |
}, 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment