Home Forums Woocommerce simply order export addon Creating a column that include shipping line 1 + shipping line 2 + City + county

This topic contains 12 replies, has 2 voices, and was last updated by  tom@curalife.co 1 month, 3 weeks ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #7953

    tom@curalife.co
    Participant

    Hi There 🙂
    I need to create a column that includes shipping line 1 + shipping line 2 + City + state/county
    That’s the only details it needs to include.
    Can you please provide me with the code we need to add in order to do this and instructions?

    #7954

    tom@curalife.co
    Participant

    If I was not clear, I need all this info and only this info in one column shipping line 1 + shipping line 2 + City + state/county

    #7966

    tom@curalife.co
    Participant

    I created a custom field for address line 1 and 2 already, can you help?

    #7986
    Ankit
    Ankit
    Keymaster

    Hi,

    Thanks for contacting support forum and sorry for delay in getting back to you. I would ensure to fix this issue asap.

    The fields which you are asking for are already present in add-on plugin and you can just check those fields and save the settings. Once saved, those fields shall appear in csv.

    Please refer attached screenshot.

    Could you please confirm if this helps?

    Regards,
    Ankit.

    #7989

    tom@curalife.co
    Participant

    Hi,

    I do not have those options, and the plugin is up-to-date. https://prnt.sc/gwesrc

    Last time you helped me to create a custom field for shipping line 1 & 2 (image 2). for some reason I have it twice:
    https://prnt.sc/gwesrc

    https://prnt.sc/gwet1r

    Currently, it is exporting these fields, BUT IN SEPARATE columns https://prnt.sc/gweqlv
    Image attached of how it currently exporting.
    I need all these fields to be exported to the same column shipping line 1 + shipping line 2 + City + state/county
    Image attached to how we want it to export.

    If needed I can give you access to our dashboard.
    I know this is possible, looks like a simple fix, can you please help us to solve this?

    #7991

    tom@curalife.co
    Participant

    Sorry, attaching an updated image for how its currently exporting with the same info as shown on the image that explains how we want it to export.

    #7995
    Ankit
    Ankit
    Keymaster

    I would request you consider providing me with temporary access (wp-admin and FTP) to your site in order to be of better help.

    Please mark the message as private while sending the details.

    Regards,
    Ankit

    #7996

    tom@curalife.co
    Participant
    This reply has been marked as private.
    #7997

    tom@curalife.co
    Participant
    This reply has been marked as private.
    #7998

    tom@curalife.co
    Participant
    This reply has been marked as private.
    #7999

    tom@curalife.co
    Participant

    Any Update man? 🙂

    #8001
    Ankit
    Ankit
    Keymaster

    1. Add this code to your theme’s functions.php file.

    function wsoe_add_custom_shipping_address_to_export( &$csv_values, $order_details, $key, $fields, $item_id, $current_item ) {
    	
    	switch ( $key ) {
    		
    		case '_custom_shipping_address':
    
    			$shipping_line_1  = get_post_meta( $order_details->get_id(), '_shipping_address_1', true );
    			$shipping_line_2  = get_post_meta( $order_details->get_id(), '_shipping_address_2', true );
    			$shipping_city   = get_post_meta( $order_details->get_id(), '_shipping_city', true );
    			$shipping_state = get_post_meta( $order_details->get_id(), '_shipping_state', true );
    			$shipping_country = get_post_meta( $order_details->get_id(), '_shipping_country', true );
    
    			$shipping_address = array( $shipping_line_1, $shipping_line_2, $shipping_city, $shipping_state, $shipping_country );
    			
    			foreach( $shipping_address as $k=>$v ){
    				if( empty( $v ) )
    					unset ( $shipping_address[$k] );
    					
    			}
    			
    			if( !empty( $shipping_address ) ){
    				$shipping_address = implode( ', ', $shipping_address);
    				array_push( $csv_values, $shipping_address );
    			}
    		break;
    		
    		default:
    		break;
    
    	}
    }
    add_action('wsoe_addon_add_to_csv', 'wsoe_add_custom_shipping_address_to_export', 10, 6 );

    2. See attached image, add custom field section like this and save setting. Once saved, select that field from list of available fields and save settings again.

    #8002

    tom@curalife.co
    Participant

    Hi Thank you for your reply,

    It looks like the shipping country is included in the code.
    We only need the shipping line 1 + shipping line 2 + city + state

    Can we simply remove this part:
    $shipping_country = get_post_meta( $order_details->get_id(), ‘_shipping_country’, true );

    ?

Viewing 13 posts - 1 through 13 (of 13 total)

Please log-in to reply to this topic