Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Harrison

    (@matt-h-1)

    Addresses should be an array of addresses like:

    $addresses = array(
    			array(
    				'first_name' => 'John',
    				'last_name' => 'Doe',
    				'company' => 'WooCommerce',
    				'address_1' => '123 Fake Street',
    				'address_2' => 'Floor 1',
    				'city' => 'San Francisco',
    				'state' => 'CA',
    				'postcode' => '90210',
    				'country' => 'US',
    			),
    			array(
    				'first_name' => 'Jane',
    				'last_name' => 'Doe',
    				'company' => 'Google',
    				'address_1' => '123 Fake Street',
    				'address_2' => 'Floor 1',
    				'city' => 'San Francisco',
    				'state' => 'CA',
    				'postcode' => '90210',
    				'country' => 'US',
    			),
    		);

    You could also parse them out from a csv file with some code using fgetcsv

    This would all be code you just run one time to do the import to the database then you should remove the code otherwise it would import new addresses every time it runs.

    One difference from that previous example is the last line would be different than it was 4 years ago. Use one or the other for billing or shipping addresses:

    update_user_meta( $user_id, 'wc_address_book_billing', $address_names );
    
    update_user_meta( $user_id, 'wc_address_book_shipping', $address_names );
    Plugin Author Matt Harrison

    (@matt-h-1)

    We just released a new version of the plugin that supports uploading addresses. When you are running version 3+ you can turn on import/export in the settings and then you are able to export and import CSVs on the My Account page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bulk adding confusion’ is closed to new replies.