mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://stackoverflow.com/questions/78601728/hide-backordered-item-metadata-from-customer-orders-and-email-notifications-in
11 lines
429 B
Text
11 lines
429 B
Text
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'hide_specific_order_item_metadata', 10, 2);
|
|
function hide_specific_order_item_metadata($formatted_meta, $item){
|
|
if( is_admin() ) return $formatted_meta; // Exit if Admin orders
|
|
|
|
foreach( $formatted_meta as $key => $meta ){
|
|
if( $meta->key === 'Backordered' ) {
|
|
unset($formatted_meta[$key]);
|
|
}
|
|
}
|
|
return $formatted_meta;
|
|
}
|