Update uses of get_formatted_metadata to pass through filter first
This commit is contained in:
parent
bdf673c86d
commit
09450393d0
|
@ -507,7 +507,10 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
||||||
$html .= '<div class="wc-order-item-sku">' . esc_html( $product_object->get_sku() ) . '</div>';
|
$html .= '<div class="wc-order-item-sku">' . esc_html( $product_object->get_sku() ) . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$meta_data = $item->get_formatted_meta_data( '' );
|
|
||||||
|
$include_all = false;
|
||||||
|
$include_all = apply_filters( 'woocommerce_get_formatted_meta_data_include_all_meta_lines', $include_all, $item );
|
||||||
|
$meta_data = $item->get_formatted_meta_data( '', $include_all );
|
||||||
|
|
||||||
if ( $meta_data ) {
|
if ( $meta_data ) {
|
||||||
$html .= '<table cellspacing="0" class="wc-order-item-meta">';
|
$html .= '<table cellspacing="0" class="wc-order-item-meta">';
|
||||||
|
|
|
@ -279,19 +279,8 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$show_metadata_line = ! $include_all &&
|
|
||||||
$product && $product->is_type( 'variation' ) &&
|
|
||||||
wc_is_attribute_in_product_name( $display_value, $order_item_name );
|
|
||||||
$show_metadata_line = apply_filters(
|
|
||||||
'woocommerce_show_product_variant_metadata_line',
|
|
||||||
$attribute_key,
|
|
||||||
$display_value,
|
|
||||||
$product,
|
|
||||||
$show_metadata_line
|
|
||||||
);
|
|
||||||
|
|
||||||
// Skip items with values already in the product details area of the product name.
|
// Skip items with values already in the product details area of the product name.
|
||||||
if ( ! $show_metadata_line ) {
|
if ( ! $include_all && $product && $product->is_type( 'variation' ) && wc_is_attribute_in_product_name( $display_value, $order_item_name ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,10 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
foreach ( $order->get_items() as $item_id => $item ) {
|
foreach ( $order->get_items() as $item_id => $item ) {
|
||||||
$product = $item->get_product();
|
$product = $item->get_product();
|
||||||
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
||||||
$item_meta = $item->get_formatted_meta_data( $hideprefix );
|
|
||||||
|
$include_all = false;
|
||||||
|
$include_all = apply_filters( 'woocommerce_get_formatted_meta_data_include_all_meta_lines', $include_all, $item );
|
||||||
|
$item_meta = $item->get_formatted_meta_data( $hideprefix, $include_all );
|
||||||
|
|
||||||
foreach ( $item_meta as $key => $values ) {
|
foreach ( $item_meta as $key => $values ) {
|
||||||
$item_meta[ $key ]->label = $values->display_key;
|
$item_meta[ $key ]->label = $values->display_key;
|
||||||
|
@ -1525,7 +1528,10 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
foreach ( $refund->get_items( 'line_item' ) as $item_id => $item ) {
|
foreach ( $refund->get_items( 'line_item' ) as $item_id => $item ) {
|
||||||
$product = $item->get_product();
|
$product = $item->get_product();
|
||||||
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
||||||
$item_meta = $item->get_formatted_meta_data( $hideprefix );
|
|
||||||
|
$include_all = false;
|
||||||
|
$include_all = apply_filters( 'woocommerce_get_formatted_meta_data_include_all_meta_lines', $include_all, $item );
|
||||||
|
$item_meta = $item->get_formatted_meta_data( $hideprefix, $include_all );
|
||||||
|
|
||||||
foreach ( $item_meta as $key => $values ) {
|
foreach ( $item_meta as $key => $values ) {
|
||||||
$item_meta[ $key ]->label = $values->display_key;
|
$item_meta[ $key ]->label = $values->display_key;
|
||||||
|
|
|
@ -220,7 +220,10 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
foreach ( $order->get_items() as $item_id => $item ) {
|
foreach ( $order->get_items() as $item_id => $item ) {
|
||||||
$product = $item->get_product();
|
$product = $item->get_product();
|
||||||
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
||||||
$item_meta = $item->get_formatted_meta_data( $hideprefix );
|
|
||||||
|
$include_all = false;
|
||||||
|
$include_all = apply_filters( 'woocommerce_get_formatted_meta_data_include_all_meta_lines', $include_all, $item );
|
||||||
|
$item_meta = $item->get_formatted_meta_data( $hideprefix, $include_all );
|
||||||
|
|
||||||
foreach ( $item_meta as $key => $values ) {
|
foreach ( $item_meta as $key => $values ) {
|
||||||
$item_meta[ $key ]->label = $values->display_key;
|
$item_meta[ $key ]->label = $values->display_key;
|
||||||
|
@ -1570,7 +1573,10 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
foreach ( $refund->get_items( 'line_item' ) as $item_id => $item ) {
|
foreach ( $refund->get_items( 'line_item' ) as $item_id => $item ) {
|
||||||
$product = $item->get_product();
|
$product = $item->get_product();
|
||||||
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
$hideprefix = ( isset( $filter['all_item_meta'] ) && 'true' === $filter['all_item_meta'] ) ? null : '_';
|
||||||
$item_meta = $item->get_formatted_meta_data( $hideprefix );
|
|
||||||
|
$include_all = false;
|
||||||
|
$include_all = apply_filters( 'woocommerce_get_formatted_meta_data_include_all_meta_lines', $include_all, $item );
|
||||||
|
$item_meta = $item->get_formatted_meta_data( $hideprefix, $include_all );
|
||||||
|
|
||||||
foreach ( $item_meta as $key => $values ) {
|
foreach ( $item_meta as $key => $values ) {
|
||||||
$item_meta[ $key ]->label = $values->display_key;
|
$item_meta[ $key ]->label = $values->display_key;
|
||||||
|
|
|
@ -3336,7 +3336,9 @@ if ( ! function_exists( 'wc_display_item_meta' ) ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $item->get_formatted_meta_data() as $meta_id => $meta ) {
|
$include_all = false;
|
||||||
|
$include_all = apply_filters( 'woocommerce_get_formatted_meta_data_include_all_meta_lines', $include_all, $item );
|
||||||
|
foreach ( $item->get_formatted_meta_data( '_', $include_all ) as $meta_id => $meta ) {
|
||||||
$value = $args['autop'] ? wp_kses_post( $meta->display_value ) : wp_kses_post( make_clickable( trim( $meta->display_value ) ) );
|
$value = $args['autop'] ? wp_kses_post( $meta->display_value ) : wp_kses_post( make_clickable( trim( $meta->display_value ) ) );
|
||||||
$strings[] = $args['label_before'] . wp_kses_post( $meta->display_key ) . $args['label_after'] . $value;
|
$strings[] = $args['label_before'] . wp_kses_post( $meta->display_key ) . $args['label_after'] . $value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue