Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Created May 21, 2019 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remcotolsma/ee3fca0527b67d521ee05ec96029f031 to your computer and use it in GitHub Desktop.
Save remcotolsma/ee3fca0527b67d521ee05ec96029f031 to your computer and use it in GitHub Desktop.
Dita adresses to JSON
<?php
$addresses = array();
foreach ( $data as $item ) {
$addresses[] = (object) array(
'company' => 'First Company',
'address' => 'First Address',
'city' => 'First City',
'postcode' => 'First Postal',
'country_code' => 'NL',
'notes' => 'First Notes',
);
}
update_user_meta( $user_id, '_dita_shipping_addresses', wp_json_encode( $addresses ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment