How to Display Products Using Product ID and SKU
From this tutorial you’ll learn how to display products using product ID and SKU in WooCommerce templates.
Adding Products Using Product ID and SKU
- First, you need to access your WordPress Dashboard. Here locate Posts or Pages tab on the left and navigate to Add New in order to add a new page (post).
- You need to add the following shortcode to the content field of the page editor to display the single product using its ID.
- If you don’t know how to find out the product ID, you need to navigate to Products tab and hover on the product you want to display by ID. At the bottom of the page, you’ll see the ID number.
- Let’s find out how to display a single product using SKU. Just add the following shortcode to the content field.
- To learn the product SKU navigate to Products, open the one you want to add, and in the Product Data block you’ll see the SKU number. If there is none, just create it.
- To display several products using SKU numbers paste this shortcode to your post or page content area.
[products skus="foo, bar, baz" orderby="date" order="desc"]
- There is also a way to display multiple products by product ID number. To do it you need to paste the following shortcode into the page or post content field.
[products ids="1, 2, 3, 4, 5"]
- Now you know how to add single product and multiple products to your website’s pages.