Repository Forums Support Expiry dates for WooCommerce PRO Hiding Expiry dates to customer cart but Not to admin Reply To: Hiding Expiry dates to customer cart but Not to admin

#4895

Hi,

We have the same issue, we disable display of expiry date but we still have it on customer email.

I’ve tried this, but no luck:

add_filter( ‘woocommerce_order_item_get_formatted_meta_data’, ‘unset_specific_order_item_meta_data’, 10, 2);
function unset_specific_order_item_meta_data($formatted_meta, $item){
// Only on emails notifications
if( is_admin() || is_wc_endpoint_url() )
return $formatted_meta;

foreach( $formatted_meta as $key => $meta ){
if( in_array( $meta->key, array(‘_wcxd_expiry_date’) ) )
unset($formatted_meta[$key]);
}
return $formatted_meta;
}

Can you help?

Thanks.