Last active
May 15, 2024 06:22
-
-
Save braddalton/2683fb90c0285516ff0f75cf6d11d541 to your computer and use it in GitHub Desktop.
Replace the Add To Cart Text with a Shopping Cart Icon In WooCommerce. Download Full Code https://wpsites.net/?p=115948
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
// Enqueue Font Awesome | |
function enqueue_font_awesome() { | |
wp_enqueue_style( 'font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' ); | |
// Change "Add to Cart" button text to a shopping cart icon | |
function custom_add_to_cart_text() { | |
echo '<i class="fas fa-shopping-cart"></i>'; // Font Awesome shopping cart icon | |
} | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_text' ); // For single product pages | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment