How to not show shortcode contents if cart is empty?

You can check the carts content then show the cart if it has some items // Add a WooCommerce Cart Total shortcode [cart_total] add_filter(‘woocommerce_add_to_cart_fragments’, ‘woocommerce_header_add_to_cart_fragment’); function woocommerce_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> <a class=”cart-contents” href=”https://wordpress.stackexchange.com/questions/274073/<?php echo $woocommerce->cart->get_cart_url(); ?>” title=”<?php _e(‘View your shopping cart’, ‘woothemes’); ?>”><i class=”fa fa-shopping-cart “></i>&nbsp;<?php echo $woocommerce->cart->cart_contents_count;?></a> <?php $fragments[‘a.cart-contents’] = … Read more

WooCommerce Custom Pagination

Hope you are doing good. You can use the below sample code: Updated: I have updated my Gist link to added code of template. Create a template with name template-product.php <?php /** * @author Baikare Sandeep * * Template Name: Product */ get_header(); ?> <?php $args = array( ‘posts_per_page’=> 12, ‘post_type’ => ‘product’, ‘post_status’ => … Read more