Support » Plugin: Advanced Order Export For WooCommerce » Add data from YITH Multiple Shipping Addresses

  • Duke

    (@dukessa)


    Hello!

    I would need to add the shipping data (per order item/qty), to the export.
    I’m using the YITH Multiple Shipping Addresses plugin.

    It works in a very similar way as the WooCommerce addon.
    User can choose a different address for each item inside an order, and for each qty of the same item.

    This is what I got this far:

    foreach ( $order->get_shipping_methods() as $item ) {
    	
    	$item_meta_data = $item->get_meta_data();
    
    	foreach ( $item_meta_data as $meta_data_item ){
    
    		if($meta_data_item->key == 'ywcmas_shipping_destination') {
    
    			var_dump($meta_data_item->value);
    
    		}
    
    	}
    }

    Which gives us:

    array(9) {
      ["country"]=>
      string(2) "IT"
      ["state"]=>
      string(2) "AB"
      ["postcode"]=>
      string(5) "12345"
      ["city"]=>
      string(7) "City Name"
      ["address"]=>
      string(25) "Some address 123"
      ["address_2"]=>
      string(0) ""
      ["first_name"]=>
      string(22) "Some First Name"
      ["last_name"]=>
      string(25) "Some Last Name"
      ["company"]=>
      string(0) ""
    }

    The company name could also be there (it’s not in this example).

    How do integrate this data, into the export??

    Thank you for your help!!

    • This topic was modified 1 year ago by Duke.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add data from YITH Multiple Shipping Addresses’ is closed to new replies.