How to get WooCommerce Product Category Link by ID?

You can use get_term_link to get the URL of Product. Category ID needed to be converted to an integer.

     $woo_cat_id_int = (int)$woo_cat_id;
     $term_link = get_term_link( $woo_cat_id, 'product_cat' );
     echo '<a href="' . esc_url( $term_link ) . '">' . $term-&gt;name . '</a>';

If you have the term Object then you can simply get the link by using below code

    $term_link = get_term_link( $term );
    echo '<a href="' . esc_url( $term_link ) . '">' . $term-&gt;name . '</a>';

Get Permalink by Page title or slug

Usually we grab a page Permalink through page ID but sometimes we had a case to grab Permalink through Page Slug or Page Title, So Below are the easiest way to grab the permalink for a page through page title or page slug.

 get_permalink( get_page_by_path( 'case-studies' ) );  
 get_permalink( get_page_by_title( 'Case Studies' ) );

How to remove Page Title at the shop page Storefront Woocommerce

To remove Page Title from the woocommerce main(shop) page with storefront theme you need to add following code in functions.php.

   function hide_shop_page_title() {
      return false;
  add_filter( 'woocommerce_show_page_title' , 'hide_shop_page_title' );

How to remove Storefront sticky add to cart from Single Product Page

New Storefront theme have sticky add to cart on Single Product Page enabled by default if you want to remove this you just need to add below code in your functions.php.

remove_action( 'storefront_after_footer', 'storefront_sticky_single_add_to_cart', 999 );

How to Change Add To Cart button text in wooCommerce

Do you want to change the ‘Add to Cart’ button text in Woocommerce? Like you want to update the text from ‘Add to Cart’ to ‘Add to Basket’, ‘Buy Now’ or View Details then you just add below snippet into your theme’s functions.php file.

add_filter('single_add_to_cart_text', 'bpt_add_cart_button_text');
function bpt_add_cart_button_text() {
    return __('Buy Now', 'woocommerce');

Hide Prices from Shop & Product Archive Pages Woocommerce

Woocommerce is most popular eCommerce platform and very easy to customize the pages by writing simple snippets. Do you want to remove/hide Prices from Shop and Product Category archive pages from Woocommerce?, you can do that through CSS and also through snippet as well. Better if use snippet instead of CSS.

Remove Prices from the Shop and Product Archive (Product Listing) Pages Woocommerce through CSS

Add Below CSS code into your theme’s style.css.

ul.products li.product span.price{
display : none !important;

Remove Prices from the Shop and Product Archive (Product Listing) Pages Woocommerce through snippet

Add Below snippet into your theme’s functions.php.

add_filter( 'woocommerce_variable_sale_price_html', 'bpt_remove_prices', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'bpt_remove_prices', 10, 2 );
add_filter( 'woocommerce_get_price_html', 'bpt_remove_prices', 10, 2 );

function bpt_remove_prices( $price, $product ) {
$price = '';
return $price;

How to display featured products WooCommerce

WooCommerce has introduce number of useful shortcodes to allow add WooCommerce related content within posts and pages or anywhere on the site. There is also a shortcode available for display Featured Products

[featured_products limit="8" columns="4"]

You can also use Product Attributes to update according to your theme design etc.

Product Attributes

limit – The number of products to display
columns – The number of columns to display

How to set Product as featured in Woocommerce

After logged into WordPress simply navigate to the “Products->All Products”, you’ll notice that there is a column containing stars as in screenshot below:

If star is Filled it’s mean it’s featured or if it’s only outline not filled then it’s not featured. To set a product to the featured products list you simply click the star and vice versa to remove.

Display Featured Products without shortcode

$args_featured = array(  
    'post_type' => 'product',  
    'meta_key' => '_featured',  
    'meta_value' => 'yes',  
    'posts_per_page' => 1  
$show_featured_query = new WP_Query( $args_featured );  
if ($show_featured_query->have_posts()) :   
    while ($show_featured_query->have_posts()) :   
        $product = get_product( $show_featured_query->post->ID );  
        // Output product information here  
wp_reset_query(); // Remember to reset  

Add product short description to Shop or Category Archive Pages : Woocommerce

if you want to add the product short description to your Woocommerce main Shop page or archive pages and display it just below the product title, you just need to add below code into your theme’s functions.php file.

function bpt_excerpt_in_product_archives() {


add_action('woocommerce_after_shop_loop_item_title','bpt_excerpt_in_product_archives', 40);