How to Display woocommerce Products by custom code

By | November 6, 2020

Sharing is caring!

In this tutorial, we discussed how to display woocommerce products with your custom HTML or with a simple layout.

The Basic Code

Display Woocommerce Products category wise:

The below code help to display the woocommerce products

You can add more conditions as per the requirement in-display woocommerce products.

‘limit’ => 8, ‘order’ => ‘ASC’, etc

for example :

USING ABOVE CODE HOW TO DISPLAY IMAGE, NAME ETC.

Display Image: <?=wp_get_attachment_url($value->image_id );?>

Display Name : <?=(wp_strip_all_tags($value->name), 7, ‘…’?> or <?=$value->name?>

Display Price : <?=$value->price;?>

Product Url : <?=$value->slug?>

Basic Functions to display woocommerce products

  • the_title() : Display the product name
  • the_excerpt() : Display the brief description about the product
  • the_content() : Dispaly the full description of the product
  • the_permalink() : Dispay the product URL
  • the_post_thumbnail() : Display product image
  • the_ID() : Display product ID

Leave a Reply

Your email address will not be published. Required fields are marked *