Skip to content

Instantly share code, notes, and snippets.

@yousufansa
Created November 20, 2020 09:26
Show Gist options
  • Select an option

  • Save yousufansa/a2e1941b2f681f15540b95fdc5ef32a0 to your computer and use it in GitHub Desktop.

Select an option

Save yousufansa/a2e1941b2f681f15540b95fdc5ef32a0 to your computer and use it in GitHub Desktop.
Electro - Display Product SKU on Cart
if( ! function_exists( 'el_child_woocommerce_get_item_data' ) ) {
function el_child_woocommerce_get_item_data( $other_data, $cart_item ) {
$_product = $cart_item['data'];
$product_sku = $_product->get_sku();
$other_data[] = array(
'name' => __( 'SKU', 'electro' ),
'value' => $product_sku,
'display' => ''
);
return $other_data;
}
}
add_filter( 'woocommerce_get_item_data', 'el_child_woocommerce_get_item_data', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment