Created
May 2, 2018 15:15
-
-
Save amielucha/4462c73485c44a8c2a7a49a31c6be075 to your computer and use it in GitHub Desktop.
Font Awesome 5 cart with a WooCommerce counter - action
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 | |
| // Place in an action. | |
| // Requires Font Awesome 5. | |
| function cs_cart_icon() { | |
| // Bail early if we don't have WC. | |
| if ( !function_exists('wc_get_cart_url') ) return; | |
| ?> | |
| <a class="cart-contents text-white" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View the shopping cart' ) ?>"> | |
| <span class="fa-layers fa-2x fa-fw"> | |
| <i class="fas fa-shopping-cart"></i> | |
| <span class="fa-layers-counter bg-secondary" data-fa-transform="grow-20"><?php echo WC()->cart->get_cart_contents_count() ?></span> | |
| </span> | |
| </a> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment