Looking for a comprehensive guide to using WooCommerce Shortcodes?

Look no further!

 

First things first are the pages WooCommerce creates when first installed and activated, if everything went well then you won’t have a need for these next shortcodes. But, as you’re using WordPress it’s highly likely a few things need some manual intervention. WooCommerce should create 11 preconfigured pages for your cart, checkout, etc. However, if it doesn’t, you accidentally deleted one or you’re just naturally curious here are the 11 shortcodes for creating dedicated WooCommerce pages: NB: When copying shortcodes, be sure to paste without formatting, so Cmd+Shift+V on a Mac or Ctrl+Shift+V on Windows.

  • [[[woocommerce_cart]]] – This will show the customers’ cart.
  • [[[woocommerce_checkout]]] – This will show the checkout page.
  • [[[woocommerce_pay]]] – This will show the Checkout -> Pay Page, used for some gateways.
  • [[[woocommerce_thankyou]]] – This shows the Order Received page, put your conversion tracking codes here!
  • [[[woocommerce_order_tracking]]] – This shows the Order Tracking page.
  • [[[woocommerce_my_account]]] – This will display the My Account Page.
  • [[[woocommerce_edit_address]]] – This page allows customers to edit their billing and shipping addresses.
  • [[[woocommerce_view_order]]] – This page allows customers to view individual order details.
  • [[[woocommerce_change_password]]] – Allows the customer to change their password.
  • [[[woocommerce_lost_password]]] – This page will display a lost password form.
  • [[woocommerce_logout]] – This will display a logout link.

It should be noted that some of these shortcodes can be combined, for example you could set up a settings page with [[[woocommerce_edit_address]]],  [[[woocommerce_change_password]]], [[woocommerce_logout]] for convenience.

 

When you install WooCommerce you’ll also find a new icon in your WYSIWYG editor (the post/pages editor), which will look very much like this: woocommerce-shortcode-kitchen-sink If you click on it you’ll find a drop down list of the various shortcodes specific to WooCommerce:

WooCommerce Shortcode Dropdown    

Product Price/Cart Button

When you click this option you’ll see the following shortcode added to your editor: [[[add_to_cart id=”” sku=””]]]. This can be used to show the price and add to cart button for a singular product, wither by id or SKU. It also allows a style=”” argument to apply custom CSS. You can find the id of a product by navigating to the products page in your WP admin and hovering over the product in question, you’ll see a greyed out id number like so:

woocommerce-find-id-number

Product By SKU/ID

Clicking this option will place this shortcode into your editor: [[[product id=”” sku=””]]]. This is fairly self explanitory and will display a singular product with specific id or SKU, e.g.

  • [[[product id=”97″]]]
  • [[[product sku=”CLUBM”]]]


Products By SKU/ID

Very similar to the previous example, this will output multiple products and insert this shortcode: [[[products ids=”” skus=””]]]. You can also apply the following arguments; order=” “, columns=” “, orderby=” “. For example this shortcode: [[[products ids=”1, 2, 3, 4, 5, 6, 7, 8, 9, 10″ columns=”2″ order=”asc” orderby=”date”]]] would output 10 products in 2 columns ordered by date in ascending order. You can also use desc for descending and title for ordering.

Product Categories

Product categories will display the product categories loop and output this shortcode: [[[product_categories number=””]]].  Specifying a number will output that many categories. There are 7 more arguments you can apply to this shortcode:

  • number‘ => ‘null‘, – This determines the number of categories.
  • orderby‘ => ‘name‘, – This determines the order, “name” and “date” are valid options.
  • order‘ => ‘ASC‘, – Determines how product categories are ordered, “ASC” or “DESC“.
  • columns‘ => ‘4′, – The number of columns categories are arranged into.
  • hide_empty‘ => ‘1‘, – Set to 1 to hide categories with no products or to show them.
  • parent‘ => ”, – Set to 0 to only display top-level categories.
  • ids‘ => ” – ids can be set to only output those specified.

 

Product Categories by Slug

This will output the shortcode: [[[product_category category=”” per_page=”12″ columns=”4″ orderby=”date” order=”desc”]]]. Similar to product categories but this will output all products within the specified category and can be arranged with the per_page=”” and columns=”” parameters. The category slug can be found by navigating to the product menu in your WP admin and clicking on categories where you’ll see a list of all available categories and corresponding slugs.

 

Recent Products

Recent Products will output, strangely enough, recently added products. The shortcode will look like this: [[[recent_products per_page=”12″ columns=”4″ orderby=”date” order=”desc”]]]. All arguments are output by default and have the same options as previous examples.

 

Featured Products

Featured products is identical to recent products, except it will output products that have been marked favourite, rather than recently added products. The shortcode is: [[[featured_products per_page=”12″ columns=”4″ orderby=”date” order=”desc”]]].

Sale Products

This and the next few shortcodes are not listed under the Woo icon, we’re not sure why, but there’s not much we can do about it! [[[sale_products]]] outputs your products currently on sale and can be adjusted with the following arguments:

  • per_page‘ => ’12’,
  • columns‘ => ‘4‘,
  • orderby‘ => ‘title‘,
  • order‘ => ‘asc

Best Selling Products

To output your best selling products you can use this shortcode: [[[best_selling_products]]], this shortcode only accepts the following arguments though:

  • per_page‘ => ‘12‘,
  • columns‘ => ‘4

Top Rated Products

If you use the ratings and reviews feature built into WooCommerce then this shortcode can be quite useful for displaying your best products; [[[top_rated_products]]]. It can be altered with the following arguments:

  • per_page‘ => ‘12‘,
  • columns‘ => ‘4‘,
  • orderby‘ => ‘title‘,
  • order‘ => ‘asc

Related Products

Whilst most themes will include a related products area in single product listings, you may want to make use of this shortcode for more custom uses. [[[related_products]]] will output related products. You can use the following arguments:

  • per_page‘ => ‘12‘,
  • columns‘ => ‘4‘,
  • orderby‘ => ‘title

 

  • Adi

    How to show only certain categories? Not the products for certain categories. Just the thumbnail of selected categories

    • http://timrfox.com Tim Fox

      [product_category category=”appliances”]

      • Kyle

        not the products in the category he said.

    • Kyle

      I had to do this a while ago, unsure if it still works but am about to try it. I know this is an old question but it’s still valid today.
      [product_categories columns=”5″ number=”5″ ids=”2037, 24, 16, 1576, 1958″]

  • Hết Giấy

    Good article!

  • Pingback: WooCommerce Customizations - High Peaks Digital()

  • Umar

    Is there is shortcode for login form?

    • GPLclub

      [[[woocommerce_my_account]]] will show the login form

      • Esteban G.

        I’d like to edit the login page but everytime I edit it… then the “my account” page gets edited…

        is there a way to just separate the login page?

        • olivernielsen

          It only displays the login form to users who are not logged in;)

  • Nancy Alvarez

    This has been very helpful, thank you.

  • rahul

    how to current user product history show woocommerce ?

  • Rudi van Heerden

    Is there a shortcode way to change [product_categories number=””] to only show children of a parent category. ie; don’t show the parent category at all.

    • Martin Coard

      See the reply to Adi’s question above. It might answer yours.

      • Omos Aziegbe

        Please, I can’t find the reply to Adi’s question

        • Martin Coard

          Hi Omos

          The reply related to a question of how display only the children of a parent category.

          So if, for example, if you want to display all products which come under the category of ‘Books’, you need to find the ID associated with ‘Books’. Woocommerce doesn’t make this ID obvious anywhere, so from the WordPress Dashboard, go to Products > Categories, then click on ‘Edit’ under the category ‘Books’ (or whatever category you’re using) and the category ID will be displayed in the browser address bar as part of the page address, i.e.:

          …../wordpress/wp-admin/edit-tags.php?action=edit&taxonomy=product_cat&tag_ID=95&post_type=product

          So the category ID is 95 and you use that in the Woocommerce shortcode:

          product_categories orderby=”ASC” columns=”4″ parent=”95″

          This will display thumbnails for all products whose parent category ID is 95, ins ascending order and with 4 columns of thumbnails.

          I hope that helps.

          • Omos Aziegbe

            Hi Martin,

            Thanks for the help. I have tried your shortcode method but getting a different result. However this gives me [product_categories ids=”10, 12″ parent=”0″] a better result as well as [product_categories number=”2″ parent=”0″]. Would keep trying your method to see if i can get the desired result.

            Thanks.

  • ജൂലിയസ് മോശെ റാഫേൽ

    Hi. Is there a shortcode to display latest products on a page?

  • Sha Hussain Shannu

    how to show all products . need short code

  • Akash Adsul

    Is their any short code to show products for excluding any category in recent products

  • Andy Carrol

    Hello
    Why when i checkout my webshop it show double payment list ?
    It start to have double payment list from i update woocommerce to version 2.3.10 .
    Who know about this problem ?

  • Rhona Swain

    ‘My Account ‘page showing up as blank page. No options to creat account or log in. Any advice please?

  • Matts

    Is there any shortcode for price only?

  • Narelle Eustace Holly

    Featured products —- is there a way to make them display the same image size (all the same ,,, not square and a mixture of rectangular ones)

  • Barh Oum

    i need the shortcode woocommerce to Returns number of items available for sale widh product

  • http://niclas.strindell.se/ Niclas Strindell

    Thanks, I’d like to use [products ids=”1, 2, 3, 4, 5, 6, 7, 8, 9, 10″ columns=”2″ order=”asc” orderby=”date”] but without the product images. Is there a parameter for thumb display for the shortcode?

  • valzyb

    Any shortcode for getting the products in a row instead of just a column?

  • Shivakant Yadav

    Hello

    How to show only product title using shortcode in woocommerce

  • http://fsistemas.mx Francisco Milland

    Does anybody knows how to add an external ULR to an image on Product Category Shortcode ej. [product_category category=”appliances”]

  • bellopapoy

    Is there a shortcode for registration and login form separately? Since I don’t like to show them in one page.

  • Musyafak Ali

    How to create spesific page for weekend sale, gift promotion page etc

  • http://www.CuttlefishMarketing.com Lauren Schroth

    How can you apply an “exception” rule to the product_categories??