WooCommerce Tutorials

Show Variations on the Shop Page With a WooCommerce Variations Plugin

As a WooCommerce store owner, you likely have a lot of products with variations. However, your customers have to click through to single product pages before they can even see them. 

By showing product variations on the shop page (as individual products), you’ll be able to make variations more appealing to customers and expand your product catalog in just a few clicks.

By the end of this article, you’ll walk away knowing exactly how to show variations on your WooCommerce shop page. The best part? You’ll be able to do it in just 2 steps with the WooCommerce variations plugin, Show Single Variations.

Start your 14-day free trial of Show Single Variations

You can start your free trial right now and instantly show WooCommerce variations on the shop page.

Get Free Trial
Start your 14-day free trial of Show Single Variations thumbnail

How Show Single Variations works

WooCommerce Show Single Variations allows you to show variations on your WooCommerce shop page, category pages, search and filter results pages. 

These variations are displayed as if they were ‘simple’ products, but link through to the parent variable product page with the options pre-selected. The screenshot below demonstrates this (variations have been labelled with a ‘Variation’ banner for demonstration purposes).

woocommerce show variations on shop page

WooCommerce Show Single Variations allows you to:

  • Display product variations on the shop page as though they are separate products.
  • Define where variations are displayed – everywhere, search results, or filtered results.
  • Show accurate filter results by displaying relevant variations and images, rather than a generic parent product.
  • Save your customers from numerous clicks by enabling them to add a specific variation to the cart, directly on the shop page.

So now we understand how Show Single Variations works, let’s get it up and running on your site.

How to show variations on the shop page

To show variations on the shop page with WooCommerce, you’ll need to:

  1. Install the WooCommerce variations plugin, Show Single Variations.
  2. Enable product variations to show on shop pages.

That’s it. Below we’ll outline these steps in detail so you can start making more sales for your online store.

Step 1: Install Show Single Variations

To get started, purchase WooCommerce Show Single Variations from the Iconic store: iconicwp.com/woocommerce-show-single-variations

Then follow these steps:

  1. Go to Plugins > Add New > Upload Plugin.
  2. Choose the zip file you downloaded, upload, and then click Activate.
  3. Once activated, you’ll need to enter your licence key.

After the plugin is installed and activated, you’ll be presented with the general settings page. 

On this page, there’s a Process Product Visibility button. It’s worth running this now as it will go through all of your products and variations and set their default visibility settings. By default, all variations are hidden until you enable them.

process product vidibility

Now that we have Show Single Variations installed, we can move onto enabling product variations to shop on the shop page.

Step 2: Enable product variations to show on shop pages

To get your variations to show individually on the shop page in WooCommerce, do the following:

  1. Go to Products > All Products in your WordPress dashboard.
  2. Select the variable product you want to edit.
  3. Scroll down to the Product Data section of the page (usually found below the main text/product description area).
  4. Click the Variations tab on the left.
  5. Click the expand arrow on the variation you want to show on the shop page.
WooCommerce variable product
  1. Once expanded, you’ll be able to see a bunch of new options, all added by the Show Single Variations Plugin, including:
    1. Show in Search Results?
    2. Show in Filtered Results?
    3. And Show in Catalog?
    4. Featured – this will show your product in featured product queries.
    5. Disable “Add to Cart”? This will change the ‘Add to Cart’ button to a ‘Select Options’ button. Useful for pre-selecting one attribute like ‘Color’ but having your customers choose the other attribute on the single product page.
show woocommerce variations in search
  1. Continue scrolling and you’ll see a Display Options section. Here you’re able to set a custom title for your variation.
  2. Once you’ve customised all your variations, hit Save Changes in the Product Data section of the page and then scroll up to the Publish section of the page and click Update.

Show variations on the shop page with Show Single Variations

That’s it, your store’s now ready to start selling variations with ease. With this up and running, you’ll be able to offer more options for your customers, faster. 

Make this change quickly and easily with WooCommerce Show Single Variations.

Start your 14-day free trial of Show Single Variations

You can start your free trial right now and instantly show WooCommerce variations on the shop page.

Get Free Trial
Start your 14-day free trial of Show Single Variations thumbnail

Learn more:

James is the founder of Iconic and an experienced WooCommerce plugin developer.

Share

77 Comments

  1. Amal Soni says:

    Hello, Thanks for this code, Is there a way to make the image change when selecting the variable from the picklist? Just like it does on the product page?

  2. Jan Hagge says:

    Hi James, I like your snippet method 1 very much. Is it possible with a small change, just showing “size variable in stock/out of stock” when howering the product image?
    Looking forward to hear your answer. Thanks.

  3. Alan says:

    Hi James
    I used your full block of code which is very nearly what I am trying to achieve. The only problem I have is that once a variation is selected and added to cart it changes all products defaults that contain that variation on that page. Is there an easy way round this please.

    Example on http://chelmsfordwholefoods

    Adding 100g to the cart on the 1st variable product ( ajwain seeds) alters 4 other product default weights.
    Thanks for your code and time.

  4. dirk2099 says:

    WHen you click the add to cart button is there a way to keep the page from redirecting to the product page?

    • Eric Embacher says:

      I would also like to know how to do this. It seems a bit daft to be able to select options from the first page, and then be redirected to a second page where you are prompted to select options…or am I missing something?

      • James Kemp says:

        This was brought in because of an update to WooCommerce. You’d need to filter woocommerce_add_to_cart_form_action and return an empty string for archive pages.

  5. Matt D says:

    Thanks for this solution. Very clean and elegant snippet. Have you given any thought to making it AJAX add to cart friendly?

  6. Mihail Skorlupkin says:

    Hi, James!

    Thanks for that snippet. Ihave 2 questions:

    1. I want to remove variation description from the shop page.

    2. I use a variation swatches. Can I make them with a carousel slider on shop page?

    Is it posible to to with some changes in your snipppet?

  7. Lorena Rivera says:

    Hi, James!! I used the first options and it looks great on my page!! Thanks a lot!
    The only problem that I have is when I click on the Add to Cart button (after I select a variation), it takes me to the CHECKOUT PAGE. It doesnt happen with the simple products.
    Its there some change to the code or something I can do to let the client stay on the shop page?
    Thanks again!!!
    (http://granelgourmet.cl/cat… The product Im working with is Aceite de Maní 250 ml.

  8. Pär Nilsson says:

    Hi,

    Great initiative. I was wondering if this plugin allows product pages with for example 5 colors, and obviously like 4-6 different sizes? if so, will it take the name of: Product name + color + Size in the category page then? All the examples i´ve seen on your site, was with only 2 variations, so i got a bit confused.

    • James Kemp says:

      Hey, yes – if they all have their own variations then that is possible. You can set a custom title for each variation.

  9. Michael says:

    Hello, this code helps me a lot. My question, is there any way to add a quantity box before the add to cart button? I already add it myself but it’s not working.

  10. Lynette says:

    Hi James, thanks for the code, I just added your snippet to my page and now the shop page is not showing the categories. I also cant get the style snippet to work, I get the following error message:

    The snippet has been deactivated due to an error on line 1: syntax error, unexpected ‘.’

    • James Kemp says:

      Hey, sounds like you may be adding it as an incorrect snippet type. You need to ensure it’s a CSS snippet, or wrapped in style tags.

  11. Ushan says:

    Hi James! Your WooCommerce Show Single Variations is certainly doing the trick. Is it possible to remove the parent product from the page if there are variations? eg Only show the variations if there are any, or just show the parent if there are none?

  12. Samuel Basash says:

    Thanks for the Code. Works so far. You’re a life saver.

  13. glenn kline says:

    How can i get this code to work with Woocommerce Custom Fields For Variation Pro Plugin?
    Looks great and it works… but it wont show any custom fields.

    Thanks

  14. Varun says:

    I had took your solution from the comments for not redirecting to the single product page after clicking on the add to cart button from product category and shop and thanks a lot its working fine,but whats the problem now is that i too have products on my home page and from here if a add to cart its again taking to single product page.Please help me with this.

  15. prashant says:

    For simple products use this function: woocommerce_template_loop_add_to_cart();
    For variable products use this function: woocommerce_variable_add_to_cart();

    So have a look this function could be something like this:

    function iconic_template_loop_add_to_cart() {
    global $product;

    if ( ! $product->is_type( ‘variable’ ) ) {
    woocommerce_template_loop_add_to_cart();
    return;
    }
    else if($product->is_type( ‘variable’ ))
    {
    woocommerce_variable_add_to_cart();
    return;
    }
    }

  16. Tom says:

    How can I make option 1 work? it didnt work for me and i need exactly this
    I followed the steps but nothing

  17. Kelly says:

    You are my hero. I have been looking for this for weeks! Any tips on getting a quantity field for each product added on the shop page as well??

  18. Nick Imming says:

    Hey there! is there a way to have the first option + the add to cart button on a different page than the shop page.
    Example: I have made a nice looking page in word press and I want to have a add to cart button on that page but also let people select the correct variation. I have been searching for a solution like this for ages now. Hope you could help!

  19. Arpit Shah says:

    Hello There,

    I like method 1 but i need some more help. Is it possible to add Quantity option after variation attributes?

    Please let me know.

    Thanks in Advance

  20. Mehran Khan says:

    Hello how can i also add quantity field please guide me ASAP ! Thanks a lot for your time i am waiting for your response

  21. Sean says:

    How do i add the quantity selector again? Thanks in advance…

  22. pol says:

    Dear, Do you know how can I disable the woocommerce_add_to_cart_redirect after adding the product to the cart with this method? Because it redirects me to the product page.

    Thanks

  23. Tyler Sands says:

    Hi, this is a bit of a combination of both methods that I’m after. Currently using your plugin and it’s great!

    I was wondering if there was a way to display dropdowns on the shop archive for products that have ALREADY been separated using the plugin. For example, there’s two variations in my case – flavour and strength.

    I’ve told the plugin to split them on flavour only by leaving all the dropdowns as “Any Strength…” in the variation section. This works fine, but then I’m stuck for a way to buy the product directly from the shop page – which is what I liked about the first example and the dropdown implementation. Is this achievable?

    • James Kemp says:

      I see! Glad you’re enjoying the plugin.

      I think it would be possible, yes. You can try the code in the example, but modify it to fetch the parent product and use that as a basis for generating the dropdowns.

      I won’t have the time to write it out personally for you, but I do think what you want would be achievable!

  24. Yumit says:

    Is it possible change product image when customer change attribute on metod 1?

    • James Kemp says:

      It’s possible! But not something I can write out for you at the moment. It’s actually possible to do that using my Swatches plugin. Might be worth checking out!

  25. Hi,
    Thanks for this wonderful post.
    It was really helpful for me as you explained very well. I found some good plugins for eCommerce at MakeWebBetter. That’s just a recommendation.
    Thanks

  26. mubeen says:

    Hi,Sir i add your first plugin code to my website but it would show two add to carts .First add to cart is not remove.Please guide me why it is show?

  27. Hugo Fredes says:

    Estimateds Good day there !

    I’ve added the code, works and looks great.

    I have only one ” problem ” , hope you can help me….

    When i add a product with variation to the cart from the shop page, it goes to the product page and if i want to continue shopping, i have to go back the shop page, is possible to no redirect when i add to the cart ? I imagine yes, can you send me the code for that please ?

    Thanks !

  28. Hari Barman says:

    THANK U SIR, sir I have no knowledge of coding and enough money for by that plugin but I use your first method it is working.. thank u again

  29. Hari says:

    HELLO SIR, when I choose a variation of a variable product and then press “add to cart button” it redirects me in the single product page, I don’t want to redirect when buying any product, how can I solve this. can you help me…

  30. Alex says:

    Error
    : Cannot redeclare iconic_template_loop_add_to_cart() (previously declared in /home/ba315311/probnik.pp.ua/www/wp-content/themes/gannapro/woocommerce/content-product.php:129) in
    /home/ba315311/probnik.pp.ua/www/wp-content/themes/gannapro/woocommerce/content-product.php
    on line
    140

  31. V says:

    woocommerce_template_single_add_to_cart();

    This part of the code makes my featured image thumbnail (on the product page) get by random other product’s image.

    If I remove this function, it works again but the “add to cart” button obviously disappears.

    Any solution to this?

  32. […] tried to use Method 1 from this article, but I couldn’t remove the add to cart […]

  33. Adri :) says:

    Hello 🙂 you are dope.. I used the code in my website, but I can’t stop the redirect after I click “Add to cart” to the single product page.. Do you know for a chance how can I help it? Thanks a lot 🙂

  34. adnan says:

    Hi there,

    thanks for snippet. In the first version, for the simple products it prints ADD TO CART button again. So there two add to cart buttons. Did you notice that?

  35. Kris says:

    Hello guys!

    Did you noticed that the ajax search will not work with either method? Do you have a solution for that?

    Thanks!

  36. sunil george says:

    its works perfectly in my website through code snippets ,how to add qty selector , pls help

  37. Gsmorigin says:

    Hi i want to add a quick add hover variant based on product Sizes is it possible using this snippet.

  38. Eirek E says:

    Hi. I think I have tried “everything”, but I am not able to make product variations appear in product searc results. Are there any known incompatabilities or anything obvious I might be missing?

    • James Kemp says:

      Hey, some themes link to the incorrect search results page (at which point the search settings wouldn’t be applied). The URL should look like:

      ?s=Some+search+term&post_type=product

      Rather than simply:

      ?s=Some+search+term

      Usually can be solved by swapping out the search field in your theme with the WooCommerce search field widget.

  39. […] We hope this article helped you learn some new useful tricks for functions.php file in WordPress. You may also refer https://iconicwp.com/blog/show-variations-shop-page-woocommerce/ […]

  40. […] We hope this article helped you learn some new useful tricks for functions.php file in WordPress. You may also refer https://iconicwp.com/blog/show-variations-shop-page-woocommerce/ […]

  41. Byron Rivera says:

    Thanks for leaving the code here and not just sell your plugin. That’s something not everyone does. Again, thanks a lot.

  42. Schalk Joubert says:

    Hi James,
    thank you so much for sharing the code snippet. It works for me on the shop page, BUT…
    I have a custom query to show products on the home page.
    I don’t use the built-in shortcode as I also show the products gallery for each of the 4 products on the home page.

    I can’t manage to change your code so that it will also work for my home page.

    If you can shed some light, please and thank you!

    ‘post_type’ => ‘product’,
    ‘stock’ => 1,
    ‘posts_per_page’ => 4,
    ‘orderby’ =>’date’,
    ‘order’ => ‘DESC’ );
    $loop = new WP_Query( $args );

  43. Fereshteh Faraji says:

    hi your code really saves me. but i have a problem that I couldn’t find my answer from above comments.
    When you click the add to cart button is there a way to keep the page from redirecting to the product page?

  44. jack says:

    Hey i Used this snippet code its work for 1st time variation product after some scroll other variation product not work properly for add to cart.

Leave a Reply

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