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