Skip to content

Instantly share code, notes, and snippets.

@teledirigido
Forked from Willem-Siebe/functions.php
Last active April 19, 2020 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teledirigido/a859a1f0b954fc3f20cf44ef11d5718e to your computer and use it in GitHub Desktop.
Save teledirigido/a859a1f0b954fc3f20cf44ef11d5718e to your computer and use it in GitHub Desktop.
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