SKU not displayed on variable product page

9 replies5 participantsUpdated by Eva Kemp

  • Avatar: devodrome
    devodrome
    Participant

    Hello,

    I create a variable product having no SKU associated to the “generic” product, since all the SKUs will come with the product variations (different SKU for each variation).

    Entering on the product page, the SKU label is missing (no matter what attributes are selected).

    However, on the standard WooCommerce plug-in (no custom theme), on the variable product page it displays “SKU: N/A”, and the SKU is changed according to the selected attributes.

    Based on our findings, the problems is in the file wp-content/themes/idstore/woocommerce/single-product/price.php (lines 26-28):

    
            <?php if ( $product->is_type( array( 'simple', 'variable' ) ) && $product->get_sku() ) : ?>
                    <span class="product-code"><?php _e('SKU:', ETHEME_DOMAIN); ?> <span class="sku"><?php echo $product->get_sku(); ?></span></span>
            <?php endif; ?>
    

    In the original price.php file from WooCommerce plug-in (wp-content/plugins/woocommerce/templates/single-product/meta.php, line 24-28) the working code is:

    
            <?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; ?>
    

    So, in order to fix this issue we modified the price.php file from your theme as following:

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

    Could you check the above patch with your developers?

    Thanks,
    Victor

    9 Answers

    Avatar: Eva
    Eva Kemp
    Participant

    Hello,

    Thank you for providing us with information.
    We’ll forward it to our developers.

    Regards,
    Eva Kemp.

    Avatar: FaridJa
    FaridJa
    Participant

    Hi guys,

    I would like to add attributes like Color label or size label below quantity dropdown. Your demo version provides that. How to do that. If I add a single product, I can add content of attributes but not a dropdown menu. How to fix that?

    Thanks for reply.

    Best Farid

    Avatar: Jack Richardson
    Jack Richardson
    Support staff

    Hello @FaridJa,

    You need to create a variable product and attributes in WP Dashboard > Products > Attributes.
    Please refer to Woocommerce documentation:
    http://docs.woothemes.com/document/variable-product/
    https://www.youtube.com/watch?v=aen8ieJuB88

    Best regards,
    Jack Richardson.

    Avatar: FaridJa
    FaridJa
    Participant

    Hello,

    sry, I don´t find a way to start a new topic.
    Just a simple question: How can I figure out, how to define/ remove products from sale category?

    Because the products shown in the link below, are no sale products.(no sale offer defined)

    Thanks for reply,

    King regards,
    Farid

    Please, contact administrator
    for this information.
    Avatar: Robert Hall
    Robert Hall
    Participant

    Hello,

    You can select or unselect products to show in category list in Dashboard->Products->Product Categories. See screenshot: http://prntscr.com/98r90l

    Regards,
    Robert Hall.

    Avatar: FaridJa
    FaridJa
    Participant

    Hello,

    I thought that too, but it is not selected.
    There is no sale category existing. It´s created with [etheme_sale] in order to output sale items.

    How to select products with that?

    regards,
    Farid

    Avatar: Jack Richardson
    Jack Richardson
    Support staff

    Hello @FaridJa,

    You need set sale price in product editor.
    Please try it.

    Best regards,
    Jack Richardson.

    Avatar: FaridJa
    FaridJa
    Participant

    Hello Jack Richardson,

    I know that. The wired thing is, I didn´t set any sale product. Nevertheless I have some producta on sale category. and I cannot figure out why in order to deselect them.

    Thanks for replay,

    regards, Farid

    Avatar: Eva
    Eva Kemp
    Participant

    Hello,

    We’re sorry for a long delay.
    The issue with sale shortcode has been fixed.
    Now it’s working correctly and to show sale products you need add sale price.

    Regards,
    Eva Kemp.

Want to reply? Log in, or register with your ThemeForest purchase code, to reply to this topic.

Login / Register