Created
June 17, 2019 19:46
-
-
Save plugin-republic/286ff75c5f85852c774686dd016fd96b 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 item data in the cart | |
*/ | |
function plugin_republic_get_item_data( $item_data, $cart_item_data ) { | |
if( isset( $cart_item_data['pr_field'] ) ) { | |
$item_data[] = array( | |
'key' => __( 'Your name', 'plugin-republic' ), | |
'value' => wc_clean( $cart_item_data['pr_field'] ) | |
); | |
} | |
return $item_data; | |
} | |
add_filter( 'woocommerce_get_item_data', 'plugin_republic_get_item_data', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment