Show Variations on the Shop Page With a WooCommerce Variations Plugin

If you run a WooCommerce store, then you know how important it is to guide your users through to the checkout with as little friction as possible.

There’s been a number of studies which indicate that fewer clicks on your store mean higher conversions. As such, it makes sense to consider showing your WooCommerce product variations on the shop page with a WooCommerce variations plugin. This includes showing them on category pages, filtered pages, and search results.

Your customers then won’t have to navigate through to the single product page to select their product options, or to see if the product they require is even available.

In this post, I’ll outline 2 methods to make your product variations accessible directly on the product listing pages.

First, I’ll share a WooCommerce variations plugin that will list variations in your shop as though they were ‘simple’ products. Then, I’ll share a snippet of code so users can select variable product options right on the shop page.

Method 1: Use a WooCommerce Variations Plugin

WooCommerce Show Single Variations is an Iconic plugin which allows you to show variations in your WooCommerce shop page, category pages, search and filter results pages. The variations are displayed as though 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.

WooCommerce variations plugin

View Demo

Buy now

Install and Configure WooCommerce Show Single Variations

Once you’ve bought the plugin, setting it up is pretty straightforward.

First, you want to upload and activate the plugin. Go to Plugins > Add New > Upload Plugin. Choose the zip file you downloaded, upload, and then click Activate. 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.

WooCommerce variations plugin

Now it’s time to start enabling product variations to show on the shop pages. Navigate to Products and then choose one of your variable products to edit.

Click the Variations tab and then select a variation that you want to enable.

Here you’ll see a number of new options. You can enable this variation to appear in the search results, filtered results, and the catalog (shop/category/shortcodes). You can also set the variation to “Featured”; this will then show up in featured product queries. The final option allows you to disable the “Add to Cart” button. 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.

There’s also a custom Title field which will show alongside the product on your shop pages.

Simply save the variations and you’ll now see them appear throughout your store, based on your settings.

Pros/Cons of This Method

Pros Cons
Makes it easier to quickly add variable products to the cart. Can increase the appearance of your product collection (could be pro or con).
No negative SEO impact as the variable product pages use a canonical link.
Accurate filter and search results.
Shows relevant product image for the variation.
Flexibility; choose which product variations to show and where.

Method 2: Snippet to Show Variable Product Options on the Shop Page

This snippet will add the variable product attribute dropdowns into the WooCommerce shop pages, allowing us to add a variable product to cart without visiting the single product page. The result can be seen below.

WooCommerce variations plugin shop

The Code

The code we need to add to achieve the above functionality is actually quite simple. I suggest adding it to your child theme, creating a feature plugin, or using the Code Snippets plugin.

First of all, we want to remove the current add to cart buttons in the loop and replace them with our own.

Here we’ve removed the woocommerce_template_loop_add_to_cart function. This will remove the add to cart button for all products, but don’t worry, we’re going to add it back in with our own iconic_template_loop_add_to_cart function.

This function checks to see if the product is variable. If it isn’t, then we just load the normal add to cart button using the woocommerce_template_loop_add_to_cart() function.

If the product is variable, we proceed to the next stage. Here I have removed the actual button from the add to cart template and replaced it with my own. All that will remain is the attribute select fields. This is so I can simplify it a bit and remove the quantity selector.

This is our simplified add to cart button for loop-based variable products.

The full block of code then looks like this:

If you’ve got this far, you may notice that the styling isn’t the prettiest. I imagine most using this technique will implement their own styling, but if you’re not sure what to do, then you can use this CSS to achieve the look in my previous screenshot. The results may vary depending on your theme.

Most modern themes have an Additional CSS tab in the customizer ( Appearance > Customize ).

Pros/Cons of This Method

Pros Cons
Makes it easier to quickly add variable products to the cart. Doesn’t give an immediate idea of what product options are available.
Can adversely affect the layout of your shop page.


Both of these methods are viable solutions for showing your product variations in your WooCommerce shop pages. However, when using our WooCommerce variations plugin, WooCommerce Show Single Variations, you can offer your customers more accurate shopping results without affecting the layout and design of your theme.

Have you got any other methods of achieving this? Is there anything you’d like to see which hasn’t been covered here? Let me know in the 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!!!
    (… The product Im working with is Aceite de Maní 250 ml.

  8. Pär Nilsson says:


    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.


  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’ ) ) {
    else if($product->is_type( ‘variable’ ))

  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.


  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.

  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:

    : Cannot redeclare iconic_template_loop_add_to_cart() (previously declared in /home/ba315311/ in
    on line

  31. V says:


    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?


Leave a Reply

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