Support » Plugin: WooCommerce » SKU not showing for variable products

  • Resolved lrolecek


    SKU is not showing on variable product pages. I’ve searched this forum and I found that this was a problem in some old versions of WooCommerce but I’m using the latest version of plugin (2.0.13) and WordPress 3.6.

    On simple product pages SKU is showing just fine. On variable products it’s missing. It seems that javascript responsible for refreshing data is working OK because for example prices are changing when I switch product variants.

    Shop is still under heavy developmnent but you can look here:

    1) Varible product – price is changing, SKU is missing

    2) Simple product – SKU is visible (thus I know I have SKU’s enabled correctly in admin and template as well)

    Any idea what might be the problem? I’d really appreciate your help because I’m quite desperate. I need visible SKUs on this one. Thanks in advance!

Viewing 12 replies - 1 through 12 (of 12 total)
  • +1

    Roy Ho


    Just remove the IF conditional check that surround the HTML out of the SKU from the meta.php file. Around LINE 18.

    The file is in the WC plugins/templates folder.


    Just from this -> $product->get_sku() From the IF statement as that is causing the issue.

    It returns an empty string is why the IF conditional is never satisfied.

    Roy Ho


    In addition, the reason why this happens is if the parent product does not have a SKU, and only your variables have, this issue will occur. Hence my comment up top stating it returns empty string as it tries to pull from the parent first. another words if you have set SKU to the parent and variables, everything will work even without modification of the code I mentioned.

    Splashingpixels, huge thank you! I can confirm that it works. I’ve never thought of that – partially because that damn field looks like disabled in the first place.

    Anyway, thanks again. Solution was dead simple. No changes in code, just type some SKU into parent product and variable SKUs will magically show up.

    I just tried this – and added 00000001 for a parent sku, but that’s all that ever shows up. I never see the variation sku even after I’ve selected values and the price appears. Still shows 00000001 as the sku.

    Any additional thoughts?

    Roy Ho


    Post your URL.

    thanks for taking a look!

    Roy Ho


    I am quite sure it is because of your theme…Try switching to 2012 theme and see if it works.

    You are absolutely right. It works in 2012.

    smashingpixels you’re like.. batman. post shipping address for beer 🙂

    HI, I am a designer so I am not so proficient with php, in this issue can you help me, exactly what I need to delete in this file? in order to show the SKU variants in my product page?
    THANK YOU so much in advance!

    <?php if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
    		<span class="sku_wrapper"><?php _e( 'SKU:', 'woocommerce' ); ?> <span class="sku" itemprop="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : __( 'N/A', 'woocommerce' ); ?></span>.</span>
    	<?php endif; ?>

    Hi @durantian, you just need to comment out 1st and 3rd line of above code.

    <?php //if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
    		<span class="sku_wrapper"><?php _e( 'SKU:', 'woocommerce' ); ?> <span class="sku" itemprop="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : __( 'N/A', 'woocommerce' ); ?></span>.</span>
    	<?php //endif; ?>

    Anyway, the best way is to fill in SKU for the parent product so that all your variants will show SKU without changing the code. Cos if you update WooCommerce version, it will be replaced.

    Hello — This is the closest blog I could find that relates to products and Sku’s. I am running into this same issue with grouped products. Is there a way to have the Sku’s displayed for grouped products? Thank you!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘SKU not showing for variable products’ is closed to new replies.