Skip to main content

Charming Theme

EN
WooCommerce Development

WooCommerce Quick View Showing Wrong Sizes? How to Fix It (Step-by-Step)

WooCommerce quick view showing sizes the product page hides? Learn why leftover variations cause it and fix it once for every product in 7 steps.

How to fix wrong sizes in a WooCommerce quick view: before and after size buttons

If your WooCommerce quick view shows sizes that the product page does not, the quick view is reading its options from the product’s variations, while the product page reads them from the product’s attributes. Leftover variations then show up in the quick view only. The fix is to make the quick view use the same rule as the product page: keep only the values that are selected on the product, in the product’s own order. This guide shows how to find the cause and fix it in one place for every product, using a real fix we made for Firefly, a denim store in Bangladesh.

The symptom

On Firefly’s shop grid, the quick view for the Off White High-Rise Bootcut Jeans offered sizes 24 to 36. The product page for the same jeans offered 24 to 30. Shoppers could choose a size in the quick view that the store did not sell on the product page.

WooCommerce quick view offering seven sizes from 24 to 36
The quick view offered seven sizes.
WooCommerce product page offering four sizes from 24 to 30
The product page for the same product offered four.

Why it happens

A variable product stores its options in two places:

  • The product’s attributes. On the Attributes tab you select which sizes the product has, for example 24, 26, 28 and 30.
  • The variations. Each combination, such as size 28 and length 41, is a separate variation with its own price and stock.

The two can drift apart. If you remove a size from the attribute but keep its variations, or create variations first and change the attribute later, the variations for that size stay in the database.

WooCommerce’s product page only shows values that are on the attribute and have a variation. Many custom quick views call $product->get_variation_attributes() instead, which returns every value found in any variation. So the leftovers appear in the quick view and nowhere else.

Diagram of product attributes and variations feeding the product page and the quick view before and after the fix
Two data sources, one rule after the fix.

Step 1: Decide which screen is right

Before changing anything, decide which list is correct. If you really sell sizes 32 to 36, the product page is wrong and you should add them to the attribute. If you do not, the quick view is wrong. For Firefly, the product page was right, so the quick view had to follow it.

Step 2: Find the quick view template

A quick view comes from your theme or a plugin. Search its files for get_variation_attributes or for the quick view’s AJAX action. In Firefly’s custom storefront plugin it was a loop like this:

<?php foreach ( $product->get_variation_attributes() as $taxonomy => $values ) : ?>
    ... one button per $value ...
<?php endforeach; ?>

If the quick view belongs to a plugin you bought, do not edit its files, because the next update will undo your change. Use a filter the plugin offers, or ask its developer.

Step 3: Back up the file

Copy the template before you edit it, for example to quick-view.php.bak, or test on a staging copy of the site. If anything goes wrong you can put the original back in seconds.

Step 4: Keep only the values selected on the product

Inside the loop, before the buttons are drawn, add four lines. $id is the product ID:

<?php
if ( taxonomy_exists( $taxonomy ) ) {
    $assigned = wc_get_product_terms( $id, $taxonomy, array( 'fields' => 'slugs' ) );
    $values   = array_values( array_intersect( $assigned, $values ) );
}
?>

wc_get_product_terms() returns the values selected on the product’s attribute, and array_intersect() keeps only those that also have a variation. That is the same rule the product page uses.

Step 5: Match the order too

Notice that the product’s list comes first in array_intersect(). PHP keeps the order of the first array, so the quick view now shows 24, 26, 28 in the same order as the product page. With the arguments the other way round, the values follow the variations, and one of Firefly’s products showed 40, 42, 24, 26.

Step 6: Clear the cache and check every product

Purge your page cache, then compare the quick view with the product page on every product, not just the one you noticed. A short script that reads both and compares them is quicker than clicking through by hand.

One warning from our own check: our first script reported 11 broken products. Every “missing” value was the first in its list, because the script dropped the first option, thinking it was the “Choose an option” placeholder. Fix your checker first, then trust its results. After that, all 12 of Firefly’s products matched in values and order.

Step 7: Tidy the leftover variations

The fix hides leftover variations from the quick view, but they are still in the database. When you have time, delete the variations you no longer sell, so your catalogue, stock reports and exports stay clean.

Frequently asked questions

Why does my WooCommerce quick view show out-of-date sizes?

The quick view probably reads its values from all variations, while the product page reads only the values selected on the product’s attribute. Variations left over from earlier settings then appear in the quick view only.

Is it safer to delete the variations or to fix the quick view?

Fixing the quick view is safer and stops the problem for every product. Deleting old variations is a good clean-up afterwards, but on its own it fixes only the products you remember to check.

Will the fix change my prices or stock?

No. It only changes which values the quick view displays. Products, variations, prices and stock are not touched.

Does this work for custom attributes that are not taxonomies?

The code checks taxonomy_exists(), so custom text attributes are left as they are. They are stored on the product itself and do not usually drift in the same way.

Will a plugin update undo my fix?

It will if you edit a plugin you did not write. Put the change in your own plugin or child theme, or use a filter the quick view plugin provides.

Want this fixed without touching code?

Our developers at ArtinTech Solution fix WooCommerce quick views, variation pickers, cart drawers and other storefront features. We read before we change, back up before we edit, and nothing goes live without your approval.

Share this article

Charming Theme

WordPress, Elementor and Shopify products and services, with practical guides for small businesses.

Keep reading

All articles