Variation SKU not showing

Hello

I have my staging site on http://nyr.rsimport.is and when a variation product is viewed on a single page like here http://nyr.rsimport.is/vorur/garmin/utivistin/fenix-5-steingratt-med-svartri-ol/ the SKU (vörunúmer) is not showing. How can I fix this ?

Hi There,

Thanks for writing in! Could you please check your WooCommerce version too see whether you’re using a X compatible version (https://theme.co/apex/forum/t/troubleshooting-version-compatibility/195). Make sure that you don’t have any deleted products your trash bin (product’s trash), as it could cause issues.

Also you can use this tool to remove any hidden products (https://wordpress.org/plugins/woocommerce-store-toolkit/).

Let us know how it goes.
Thanks!

Hello

I have X version 6.0.4 and WooCommerce version 3.3.3. I deleted all the products in the trash and installed the Store Toolkit plugin though I’m not sure what option there deletes any hidden products…

I moved the SKU above the price (a request from my customer) with this function

add_action( 'woocommerce_single_product_summary', 'dev_designs_show_sku', 5 );
function dev_designs_show_sku(){
    global $product;
    echo 'SKU: ' . $product->get_sku();
}

Hi There,

Could you please check that the SKU is already inserted?

Would you mind providing us with login credentials(by clicking on the Secure Note button at the bottom) so we can take a closer look? To do this, you can make a post with the following info:

  • Link to your site
  • WordPress Admin username / password

Thanks.

The variation SKU is set for all variations in the system. The link to the site is http://nyr.rsimport.is/wp-admin

Hello There,

Thanks for providing the information. I have checked your site and the SKU is now displaying.

Do you need it to display anywhere else or re position the order of display?

Please let us know how it goes.

Hi

The SKU is not showing for variation products as can be seen here

http://nyr.rsimport.is/vorur/garmin/hreyfing-heilsa/vivoactive-3/

Hey @gretar,

I tested the product variation SKU in my test site and it works. It looks like the problem is with a third party plugin or custom code. Regretfully, we cannot provide support for third party plugins or scripts due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X / Pro will need to be directed to the original developer. Or, you would need to seek help from a third party developer so he could determine what is causing this issue in your site.

Thank you for your understanding.

Well the only code I have that could effect this is in functions.php to display the SKU below the product name.

This is the code
    // =============================================================================
// 
add_action( 'woocommerce_single_product_summary', 'dev_designs_show_sku', 5 );
function dev_designs_show_sku(){
    global $product;
    echo 'Vörunúmer: ' . $product->get_sku();
}

I also have another issue with translations. After I updated WooCommerce the backend is in English and some strings are missing in Icelandic on the site. I’m getting very tired of these translations problems with your theme, I’ve spent countless hours trying to figure this out and one update on your theme or WooCommerce always breaks everything. What is the correct guideline for getting the Icelandic language to work without breaking after update ? I have a child theme with a lang folder under framework, there are the woocommerce and theme language files. I also have under wp-content a languages folder, under this folder is a special themes folder where I have x-is_IS.po and .mo files and I also have a special plugins and woocommerce folder under languages but nothing seems to work.

Hi there,

That’s the problem, your custom code :slight_smile:

That code displays the SKU of the product upon page load. But with variation, you change it by clicking the given options (not upon page load).

You need to add more customization and display SKU to that area upon clicking those options (maybe through AJAX). It’s not gonna change just by adding a PHP code because those options are running in Javascript code.

About the translation, it should stay intact after update if it’s under a child theme. I recommend starting a new thread about this issue so we could focus on this one. Translation is a bit tricky and unpredictable regardless of theme or plugin.

Thanks!

Ok, so I will have to remove the code but can you help me display the SKU at the same place as it is no so it will work with variation products ? My client wants to display the SKU under the product name.

I will start a new thread about the translations.

Hello There,

Always remember that when you want to display SKU, you must make sure that all your products has SKU and that you have added it. I edited the product and it turns out that the SKU is missing. This is one of the reason why your SKU is not showing.

Hope this helps.

This is a varitaion product and the SKU should only be visible when a variation is selected. If you would have read what I said in the beginning you would have noticed I specifically said this is for variation product. The title of this support post also says Variation SKU not showing.

I’m really sorry but your support is always top notch but this is not good, you guys are telling my something I know 2x already in this support thread !! My client doesn’t have a SKU for the main variation products, only the variations…

I asked this question in my last post: Ok, so I will have to remove the code but can you help me display the SKU at the same place as it is now so it will work with variation products ?

Please answer that question and stop telling me things I already know.

I’m trying not to be impolite, I know you guys are doing your best here but just a thorough read on my first post should have saved both of us time here.

Hello There,

Thank you for the clarifications. You will have to modify your code which would check if the product is variable or not. If it is a variable product then SKU is displayed and if not, it will do nothing. Please make use of this code instead:

// This is the code
// =============================================================================
// 
add_action( 'woocommerce_single_product_summary', 'dev_designs_show_sku', 5 );
function dev_designs_show_sku(){
    global $product;
    if ( $product->is_type( 'variable' ) ) {
      echo 'Vörunúmer: ' . $product->get_sku();
    } else {
      // do nothing
    }
}

We apologized if you have been disappointed with our first reply. You must also understand that WooCommerce is a 3rd party plugin and what you have just requested is considered a custom development since it goes beyond the default behaviour of the SKU and how it is displayed in the product page. Always keep in mind that our support only covers getting your site setup bug fixes and minor cosmetic changes only. Anything that is not available as a feature of functionality of the theme or a plugin is considered a custom development.

Thank you for your understanding.

Thank you guys for this. I understand that your support is limited to the X theme and like I said earlier your support is always very good.

I have edited this function but the SKU is still not showing for variations… maybe I need to hook into something more when I check if the product is variable or not ?

Sorry for the confusion. As @Rad has said previously,

The action hook might be already correct since the code is outputted in the place you wanted it to display. It is the function that is the problem. Regretfully, we could not help with that is this would be getting into custom development. Try reaching out to WooCommerce support or hire a web developer to code a working function for you.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.