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!
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 .