Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_cart_item_name', 'showing_sku_in_cart_items', 99, 3 );
- function showing_sku_in_cart_items( $item_name, $cart_item, $cart_item_key ) {
- // The WC_Product object
- $product = $cart_item['data'];
- // Get the SKU
- $sku = $product->get_sku();
- // When sku doesn't exist
- if(empty($sku)) return $item_name;
- // Add the sku
- $item_name .= '<br><small class="product-sku">' . __( "SKU: ", "woocommerce") . $sku . '</small>';
- return $item_name;
- }
Advertisement
Add Comment
Please, Sign In to add comment