Created
December 8, 2022 08:12
-
-
Save remcotolsma/db12cce947432dfa642a5234f838f512 to your computer and use it in GitHub Desktop.
Combine WooCommerce order meta data in one meta data field.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( | |
'woocommerce_after_order_object_save', | |
function( $order ) { | |
$data = [ | |
$order->get_meta( 'meta 1' ), | |
$order->get_meta( 'meta 2' ), | |
$order->get_meta( 'meta 3' ), | |
$order->get_meta( 'meta 4' ), | |
]; | |
$all = implode( ', ', $data ); | |
$order->update_meta_data( 'meta all', $all ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment