diff --git a/plugins/woocommerce/changelog/fix-36473-HPOS-internal-meta-keys b/plugins/woocommerce/changelog/fix-36473-HPOS-internal-meta-keys new file mode 100644 index 00000000000..bbdc980fa39 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-36473-HPOS-internal-meta-keys @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Eliminate data store internal meta keys duplicates diff --git a/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php b/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php index c94907bd04d..4df9c42f142 100644 --- a/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php +++ b/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php @@ -108,7 +108,15 @@ class WC_Data_Store_WP { * @return mixed|void */ public function filter_raw_meta_data( &$object, $raw_meta_data ) { - $this->internal_meta_keys = array_merge( array_map( array( $this, 'prefix_key' ), $object->get_data_keys() ), $this->internal_meta_keys ); + $this->internal_meta_keys = array_unique( + array_merge( + array_map( + array( $this, 'prefix_key' ), + $object->get_data_keys() + ), + $this->internal_meta_keys + ) + ); $meta_data = array_filter( $raw_meta_data, array( $this, 'exclude_internal_meta_keys' ) ); return apply_filters( "woocommerce_data_store_wp_{$this->meta_type}_read_meta", $meta_data, $object, $this ); }