VIA BUSINESS BLOOMERS

WooCommerce: Display Variations’ SKU @ Product Admin

I find it quite annoying that variable products display an empty SKU cell in the WordPress > Products admin page even if their variations may have one available.

Today, we go fix that. With this simple snippet, your variable products will display the SKU of each variation, and if there is none, empty brackets (so, it’s easy to identify if any variation is missing its SKU).

So, let’s see how it’s done. Enjoy!

"use strict"; var adace_load_62f09b0fa5dae = function(){ var viewport = $(window).width(); var tabletStart = 601; var landscapeStart = 801; var tabletEnd = 961; var content = '%3Cdiv%20class%3D%22adace_adsense_62f09b0fa5be0%22%3E%3Cscript%20async%20src%3D%22%2F%2Fpagead2.googlesyndication.com%2Fpagead%2Fjs%2Fadsbygoogle.js%22%3E%3C%2Fscript%3E%0A%09%09%3Cins%20class%3D%22adsbygoogle%22%0A%09%09style%3D%22display%3Ablock%3B%22%0A%09%09data-ad-client%3D%22ca-pub-9250614219462833%22%0A%09%09data-ad-slot%3D%224692840435%22%0A%09%09data-ad-format%3D%22horizontal%22%0A%09%09%3E%3C%2Fins%3E%0A%09%09%3Cscript%3E%28adsbygoogle%20%3D%20window.adsbygoogle%20%7C%7C%20%5B%5D%29.push%28%7B%7D%29%3B%3C%2Fscript%3E%3C%2Fdiv%3E'; var unpack = true; if(viewport=tabletStart && viewport=landscapeStart && viewport=tabletStart && viewport=tabletEnd){ if ($wrapper.hasClass('.adace-hide-on-desktop')){ $wrapper.remove(); } } if(unpack) { $self.replaceWith(decodeURIComponent(content)); } } if($wrapper.css('visibility') === 'visible' ) { adace_load_62f09b0fa5dae(); } else { //fire when visible. var refreshIntervalId = setInterval(function(){ if($wrapper.css('visibility') === 'visible' ) { adace_load_62f09b0fa5dae(); clearInterval(refreshIntervalId); } }, 999); }

})(jQuery);

With the snippet below, you can display the list of children SKUs for variable products

PHP Snippet: Show Each Variation SKU @ WordPress Dashboard > Products Table

/**
 * @snippet       Display Variation SKUs @ WooCommerce Product Admin
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_filter( 'woocommerce_product_get_sku', 'bbloomer_variable_product_skus_admin', 9999, 2 );

function bbloomer_variable_product_skus_admin( $sku, $product ) {
   if ( ! is_admin() ) return $sku;
	global $post_type, $pagenow;
	if ( 'edit.php' === $pagenow && 'product' === $post_type ) {
		if ( $product->is_type('variable') ) {
			$sku = '';
			foreach ( $product->get_children() as $child_id ) {
				$variation = wc_get_product( $child_id ); 
				if ( $variation && $variation->exists() ) $sku .= '(' . $variation->get_sku() . ') ';
			}
		}
	}
   return $sku;
}

WooCommerce: Display Variations’ SKU @ Product Admin .

mersin escortmersin escort