I would like to remove some ugly looking arrows that are standard on cart buttons in WooCommerce. To achieve this, I found a tip of adding the following code, which should remove the arrows when the document has loaded.
I assume I am going to put it in my functions.php? How exactly would I do that?
$(document).ready(function() {
$(".woocommerce-cart").html(function(i, val) {
return val.replace(" →", "");
});
$(".woocommerce-cart").html(function(i, val) {
return val.replace("← ", "");
});
});
EDIT
Okay. I've tried this approach:
Made a file named 'removeArrows.js' and placed it in my plugin folder. This has the same content as the original code, except jQuery instead $. Then I added the following to functions.php:
function wpb_adding_scripts() {
wp_register_script('my_amazing_script', plugins_url('removeArrows.js', FILE), array('jquery'),'1.1', true);
wp_enqueue_script('my_amazing_script');
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
I can't figure out how to make the code display properly. This did not work. Any suggestions to make this work?
wp-enqueue-script
it. You'll also have to change the$
s tojQuery
(see that page section 7)