Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace the 'x' in WooCommerce cart.php with text because 'x' is not helpfull at all for screenreader users. I give a extra class to the text so that it can be hidden with CSS for visual browsers, because I replace that link with Font Awesome icon using :before. See also: https://github.com/woothemes/woocommerce/issues/5725.
// Replace the 'x' in WooCommerce cart.php with text because 'x' is not helpfull at all for screenreader users.
// https://gist.github.com/teledirigido/a859a1f0b954fc3f20cf44ef11d5718e/edit
function woocommerce_remove_item( $html, $cart_item_key ) {
$cart_item_key = $cart_item_key;
$html = sprintf( '<a href="%s" class="remove" title="%s"><span class="wsis-remove-item">%s</span></a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
__( 'Remove', 'woocommerce' ),
__( 'Remove', 'woocommerce' ));
return $html;
}
add_filter ( 'woocommerce_cart_item_remove_link', 'woocommerce_remove_item', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment