woocommerce show variations on shop page

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

Start your free trial now and instantly show WooCommerce variations on the shop page.

or learn more

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 labeled 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/catalog 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

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

Or start a free trial:

Start your 14-day free trial of Show Single Variations

Start your free trial now and instantly show WooCommerce variations on the shop page.

or learn more

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 license key.

Once installed, you’ll see 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 customized 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.

Troubleshooting: WooCommerce variations not showing or working

If you’re having trouble with your WooCommerce variations not showing or working, there may be a few things causing the problem.

First of all, make sure to check you’ve set up your variable product correctly. We have step-by-step instructions on how to do this in our variable product guide. Just scroll down to the how-to section.

Next, if you’re using Show Single Variations, you need to make sure you’re setting the variations to be visible in the catalog. Please refer to our in-depth documentation which will walk you through it.

Lastly, if you’re using Show Single Variations and are still having problems after checking our docs. You can get in touch with us via a support ticket.

Show variations on the shop page with Show Single Variations

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

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

Start your 14-day free trial of Show Single Variations

Start your free trial now and instantly show WooCommerce variations on the shop page.

or learn more

Avatar

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

Share

79 Comments

  1. Avatar 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. Avatar 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. Avatar James Kemp says:

    Hey, someone else mentioned this the other day. I proposed this snippet to fix it! https://gist.github.com/ico

  4. Avatar dirk2099 says:

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

    • Avatar 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?

      • Avatar 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.

        • Avatar Eric Embacher says:

          Thanks James. Unfortunately I’d need more detailed explanation of what to do (I know JS/PHP/CSS/HTML, but am a novice at custom tweaking for WooCommerce). I also wouldn’t expect you to give me a tutorial for free…I’d gladly pay you for a detailed set of instructions!

  5. Avatar 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. Avatar 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. Avatar 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.

    • Avatar 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.

  8. Avatar 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.

  9. Avatar 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 ‘.’

    • Avatar 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.

  10. Avatar 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?

  11. Avatar Samuel Basash says:

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

  12. Avatar 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

  13. Avatar 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.

  14. Avatar 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;
    }
    }

  15. Avatar 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

  16. Avatar 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??

  17. Avatar 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!

  18. Avatar 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

  19. Avatar 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

  20. Avatar Sean says:

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

  21. Avatar 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

  22. Avatar 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?

    • Avatar 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!

  23. Avatar Yumit says:

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

    • Avatar 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!

  24. Avatar Shaarif Siddiqui says:

    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

  25. Avatar 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?

  26. Avatar 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 !

  27. Avatar 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

  28. Avatar 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…

  29. Avatar 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

  30. Avatar 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?

  31. Pre-select variation when displaying on a separate page – WordPress Solutions Group says:

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

  32. Avatar 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 🙂

  33. Avatar 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?

  34. Avatar 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!

  35. Avatar sunil george says:

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

  36. Avatar Gsmorigin says:

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

  37. Avatar 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?

    • Avatar 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.

  38. […] 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/ […]

  39. Display Product Variations In Shop/Catalogue Page – Tech Inspiration says:

    […] 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. Avatar 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.

  41. Avatar 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 );

  42. Avatar 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?

  43. Avatar 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.

  44. Avatar Naresh Yadav says:

    /**
    * Replace add to cart button in the loop.
    */
    function mycustom_change_loop_add_to_cart() {
    remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );
    add_action( ‘woocommerce_after_shop_loop_item’, ‘mycustom_template_loop_add_to_cart’, 10 );
    }

    add_action( ‘init’, ‘mycustom_change_loop_add_to_cart’, 10 );

    /**
    * Use single add to cart button for variable products.
    */
    function mycustom_template_loop_add_to_cart() {
    global $product;

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

    remove_action( ‘woocommerce_single_variation’, ‘woocommerce_single_variation_add_to_cart_button’, 20 );
    add_action( ‘woocommerce_single_variation’, ‘mycustom_loop_variation_add_to_cart_button’, 20 );

    woocommerce_template_single_add_to_cart();
    }

    /**
    * Customise variable add to cart button for loop.
    *
    * Remove qty selector and simplify.
    */
    function mycustom_loop_variation_add_to_cart_button() {
    global $product;

    ?>

    single_add_to_cart_text() ); ?>
    <input type="hidden" name="add-to-cart" value="get_id() ); ?>” />
    <input type="hidden" name="product_id" value="get_id() ); ?>” />

    <?php
    }

    Sir , Above snippet creates duplicate add to cart button and it is redirecting when adding product to cart. please sir customize this code. I appropriate your effort to make code like this.

  45. Avatar fred says:

    Is their any shortcode we can generate to show variation as single product on any pages?

Leave a Reply

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