ID;
$count=1;
$mep_events_extra_prices = get_post_meta($post->ID, 'mep_events_extra_prices', true);
if ( $mep_events_extra_prices ){
foreach ($mep_events_extra_prices as $field) {
?>
cart_contents as $key => $value ) {
$cp = $value['event_tp'];
$value['data']->set_price($cp);
$new_price = $value['data']->get_price();
}
}
function mep_display_custom_fields_text_cart( $item_data, $cart_item ) {
$count =1;
echo "
";
foreach ($cart_item as $_cart_item){
if(!empty($cart_item["AddtP_".$count])){
echo "- ".mep_get_item_name($cart_item["AddtP_".$count])." - ".get_woocommerce_currency_symbol().mep_get_item_price($cart_item["AddtP_".$count])."
";
}
$count++;
}
echo "
";
return $item_data;
}
add_filter( 'woocommerce_get_item_data', 'mep_display_custom_fields_text_cart', 10, 2 );
function mep_add_custom_fields_text_to_order_items( $item, $cart_item_key, $values, $order ) {
$count =1;
foreach ($values as $_values){
$item->add_meta_data( __( mep_get_item_name($values["AddtP_".$count]), 'atn' ), get_woocommerce_currency_symbol().mep_get_item_price($values["AddtP_".$count]) );
$count++;
}
}
add_action( 'woocommerce_checkout_create_order_line_item', 'mep_add_custom_fields_text_to_order_items', 10, 4 );