In this guide, discover how to seamlessly display SKU in Wishlist Table with this code snippet.
This code snippet facilitates how to display SKU in Wishlist Table. By utilizing the ‘wlfmc_table_product_details_end’ action hook, the custom function ‘wlfmc_show_sku_in_tables’ is called, allowing you to enhance your WooCommerce wishlist by including SKU information for each product.
How To Display SKU in Wishlist Table? #
To Display SKU in Wishlist Table, follow these steps:
- Access your WordPress theme’s directory.
- Locate the functions.php file.
- Insert the following code snippet into the functions.php file:
function wlfmc_show_sku_in_tables( $item, $wishlist, $atts ) {
$product = $item->get_product();
if ( $product ) {
echo esc_attr( 'Sku:'. $product->get_sku() );
}
}
add_action( 'wlfmc_table_product_details_end', 'wlfmc_show_sku_in_tables', 10, 3 );
- Save the functions.php file.
Result #
Here you can see the result for this feature: