Last active
November 11, 2017 11:20
-
-
Save bhavik-kiri/56683f3874a5ae56e3c194e849d3651e to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Display custom data on cart and checkout page. | |
*/ | |
add_filter( 'woocommerce_get_item_data', 'get_item_data' , 25, 2 ); | |
function get_item_data ( $other_data, $cart_item ) { | |
if ( isset( $cart_item [ 'custom_data' ] ) ) { | |
$custom_data = $cart_item [ 'custom_data' ]; | |
$other_data[] = array( 'name' => 'Name', | |
'display' => $custom_data['customer_name'] ); | |
$other_data[] = array( 'name' => 'Message', | |
'display' => $custom_data['customer_message'] ); | |
} | |
return $other_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment