WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] SKU not showing for variable products (13 posts)

  1. lrolecek
    Member
    Posted 11 months ago #

    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
    http://www.gun-ex.com/product/rocket/

    2) Simple product - SKU is visible (thus I know I have SKU's enabled correctly in admin and template as well)
    http://www.gun-ex.com/product/core-machine/

    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!

    http://wordpress.org/plugins/woocommerce/

  2. jjsararas
    Member
    Posted 11 months ago #

    +1

  3. Roy Ho
    Member
    Posted 11 months ago #

    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.

    OR

    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.

  4. Roy Ho
    Member
    Posted 11 months ago #

    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.

  5. lrolecek
    Member
    Posted 11 months ago #

    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.

  6. jjsararas
    Member
    Posted 11 months ago #

    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?

  7. Roy Ho
    Member
    Posted 11 months ago #

    Post your URL.

  8. jjsararas
    Member
    Posted 11 months ago #

    thanks for taking a look!

    http://shoutkey.com/lookout

  9. Roy Ho
    Member
    Posted 11 months ago #

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

  10. jjsararas
    Member
    Posted 11 months ago #

    You are absolutely right. It works in 2012.

    smashingpixels you're like.. batman. post shipping address for beer :)

  11. durantian
    Member
    Posted 2 months ago #

    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; ?>
  12. terrytsang
    Member
    Posted 2 months ago #

    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.

  13. dhendric25
    Member
    Posted 2 months ago #

    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!

Reply

You must log in to post.

About this Plugin

About this Topic