Created
November 20, 2020 09:26
-
-
Save yousufansa/a2e1941b2f681f15540b95fdc5ef32a0 to your computer and use it in GitHub Desktop.
Electro - Display Product SKU on Cart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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