February 5, 2024 · 14 minutes read

Integrating Advanced Order Export with Third-Party Applications: Best Practices

The use of third-party applications has become increasingly popular among businesses looking to streamline their operations and improve efficiency. From accounting software to customer relationship management tools, these applications offer a wide range of features that can benefit a business in various ways.

One of the key areas where third-party applications can be particularly useful is in order management. With the rise of e-commerce and online shopping, businesses need to have a robust order management system in place to handle the increasing volume of orders. This is where integrating Advanced Order Export for WooCommerce with third-party applications can be a game-changer.

What is Advanced Order Export?

Advanced Order Export for WooCommerce allows businesses to export their order data in a customizable format. This can include order details such as customer information, product details, shipping information, payment information and etc. This data can then be transferred to third-party applications for further processing.

Integrating Advanced Order Export with Third-Party Applications: The Benefits

  1. Streamlined Order Management Process

Integrating Advanced Order Export for WooCommerce with third-party applications can streamline the order management process. Instead of manually entering order data into different systems, businesses can automatically transfer the data to the third-party application. This eliminates the chances of human error and saves time, allowing businesses to focus on other important tasks.

  1. Improved Efficiency

By automating the transfer of order data, businesses can improve their efficiency. This is because orders can be processed and fulfilled faster, reducing the time it takes for a customer to receive their order. This can lead to increased customer satisfaction and repeat business.

  1. Real-Time Data Synchronization

Integrating Advanced Order Export for WooCommerce with third-party applications allows for real-time data synchronization. This means that any changes made to an order, such as updates to shipping information or product quantities, will be reflected in both the order management system and the third-party application. This ensures that all systems have the most up-to-date information, reducing the chances of errors or delays.

Best Practices for Integrating Advanced Order Export with Third-Party Applications

Integrating Advanced Order Export for WooCommerce with third-party applications can be a complex task and requires careful planning and implementation. One of the key factors to consider when integrating these systems is compatibility. It is essential to ensure that the order export system and the third-party applications are compatible and can communicate effectively with each other.

Note: You can find a complete list of compatible plugins by following this link.

Tickera

Tickera is a popular WordPress plugin that is used by event organizers to sell tickets online. It is a comprehensive and user-friendly solution for managing ticket sales and registrations for events of any size. The plugin integrates seamlessly with any WordPress theme, making it easy for event organizers to create a professional-looking and customizable ticketing system.

An example of a simple event template with the ability to buy a ticket online.

Integrating Tickera with Advanced Order Export For WooCommerce is a straightforward process. You can follow these steps to set it up:

  1. Buy Bridge for WooCommerce. You won’t be able to export tickets until they become a WooCommerce product. Our plugin only works with WooCommerce.

Note: The ticket creation process will be different with this add-on. Read about it here.

  1. Paste the following code into a snippet, for example using the Code Snippets plugin.
add_filter('woe_get_order_product_fields',function ($fields) {
	$fields['event_name'] = array('label'=>'Event Name','colname'=>'Event Name','checked'=>1);
	$fields['event_start_at'] = array('label'=>'Event Start','colname'=>'Event Start','checked'=>1);
	$fields['event_end_at'] = array('label'=>'Event End','colname'=>'Event End','checked'=>1);
	$fields['event_location'] = array('label'=>'Event Location','colname'=>'Event Location','checked'=>1);
	$fields['ticket_type'] = array('label'=>'Ticket Type','colname'=>'Ticket Type','checked'=>1);
	$fields['ticket_owner'] = array('label'=>'Ticket Owner Name','colname'=>'Ticket Owner Name','checked'=>1);
	$fields['ticket_owner_first'] = array('label'=>'Ticket Owner First Name','colname'=>'Ticket Owner First Name','checked'=>1);
	$fields['ticket_owner_last'] = array('label'=>'Ticket Owner Last Name','colname'=>'Ticket Owner Last Name','checked'=>1);
	$fields['ticket_email'] = array('label'=>'Ticket Owner Email','colname'=>'Ticket Owner Email','checked'=>1);
	$fields['ticket_code'] = array('label'=>'Ticket Code','colname'=>'Ticket Code','checked'=>1);
	
	// get form  fields 
	$args = array(
		'post_type'              => 'tc_form_fields',
		'post_status'            => 'publish',
		'posts_per_page'         => -1,
		'no_found_rows'          => true,
		'update_post_term_cache' => false,
		'update_post_meta_cache' => false,
		'cache_results'          => false,
		'fields'                 => array( 'ID', 'post_parent' ),
	);
	$custom_fields = get_posts( $args );
	if ( count( $custom_fields ) > 0 ) {
		foreach ( $custom_fields as $custom_field ) {
			$form_status = get_post_status( $custom_field->post_parent );
		    $form_title = get_the_title( $custom_field->post_parent );
			if ( $form_status == 'publish' ) {
				$element_class_name = get_post_meta( $custom_field->ID, 'field_type', true );
				$form_type = get_post_meta( $custom_field->post_parent, 'form_type', true );
				if ( class_exists( $element_class_name ) ) {
					$element = new $element_class_name( $custom_field->ID );
					if ( $element->standard_field_export( $element->element_name, true ) ) {
						$field = $element->admin_order_details_page_value();
						
						// add new field 
						$fields['ticket_CF_' . $field['id'] ] = array('label'=>"[$form_title] " . $field['field_title'],'colname'=>"[$form_title] " . $field['field_title'],'checked'=>1);
					}// if can be exported 
				}// 
			}
		} // if visible 
	}	// if fields 
	return $fields;
});


add_filter('woe_fetch_order_products', function ($data, $order, $labels, $format, $static_vals ) {
    $ticket_field_names = array("event_name","event_start_at","event_end_at","event_location","ticket_type","ticket_owner","ticket_email","ticket_code");
	$first_row = array_shift(array_values($data));
  
    //run only if Tickera fields was added to export
    $has_ticket_columns = false;
    foreach($first_row as $key=>$value) {
		if( in_array($key,$ticket_field_names) OR preg_match('#^ticket_CF_(.+)$#',$key,$field_key) ) {
		  $has_ticket_columns = true;
		  break; 
		}
    }
    if( !$has_ticket_columns )
	   return $data;
  
	$new_data = array();
	$used_keys = array();
  
	$args = array(
		'posts_per_page' => -1,
		'orderby' => 'post_date',
		'order' => 'ASC',
		'post_type' => 'tc_tickets_instances',
		'post_parent' => $order->get_id(),
	);
	$tickets = get_posts($args);
	foreach($tickets  as $pos=>$ticket) {
		
		//fill ticket data	
		$ticket_type_id = get_post_meta($ticket->ID, 'ticket_type_id', true);// it's a product_id !!!
		if( $ticket_type_id )  {
			$ticket_type = new TC_Ticket($ticket_type_id);
			if( $ticket_type  ) {
				// must find Item ID of main product
				foreach($order->get_items() as $item_id=>$item) {
					if( $item['product_id'] == $ticket_type_id OR  $item['variation_id'] AND $item['variation_id'] == $ticket_type_id) {
						$new_row = $data[$item_id];
						$used_keys[] = $item_id;
						break;
					}
				}
				
				$event_id = $ticket_type->get_ticket_event();
				$event = get_post($event_id, ARRAY_A);
				
				//gather details 
				$t_data = array();
				$t_data['event_name']	=  $event['post_title'];
				$t_data['event_start_at']	=  get_post_meta( $event_id , 'event_date_time', true);
				$t_data['event_end_at']	=  get_post_meta( $event_id , 'event_end_date_time', true);
				$t_data['event_location']	=  get_post_meta( $event_id , 'event_location', true);
				$t_data['ticket_type']	=  $ticket_type->details->post_title;
				$t_data['ticket_owner']	=  get_post_meta($ticket->ID, 'first_name', true) ." " .get_post_meta($ticket->ID, 'last_name', true); 
				$t_data['ticket_owner_first']	=  get_post_meta($ticket->ID, 'first_name', true); 
				$t_data['ticket_owner_last']	=  get_post_meta($ticket->ID, 'last_name', true); 
				$t_data['ticket_email']	=  get_post_meta($ticket->ID, 'owner_email', true); 
				$t_data['ticket_code']	=  get_post_meta($ticket->ID, 'ticket_code', true);
				
				//fill only selected Tickera fields 
				foreach($t_data as $key=>$value)
					if( isset($first_row[$key]))
						$new_row[$key] = $value;
						
				//	try to get Custom Form fields 	
				foreach($first_row as $key=>$value) {
					if( preg_match('#^ticket_CF_(.+)$#',$key,$field_key) )
						$new_row[$key] = get_post_meta($ticket->ID, $field_key[1], true);
				}
				
				//done!
				$new_data[] = $new_row;
			}	
		}	
	}
	
	// export items which have NO tickets!
	foreach($data as $key=>$row)
		if( !in_array($key, $used_keys) )
			$new_data[] = $row;
		
	return $new_data;
},10,5);
  1. Customize your report. We wrote about this in articles and. Without going into details, you can leave all the default settings and choose your desired export format.

The result of integration of Tickera and Advanced Order Export for WooCommerce (fields are customized).

Extra Product Options for WooCommerce by Themehigh

With Extra Product Options for WooCommerce, store owners can create custom fields for their products, such as text fields, drop-down menus, checkboxes, and more. This allows customers to add additional information, such as engraving details or color preferences, to their orders. However, when it comes to exporting these orders, the default WooCommerce export feature does not include the custom product options. This can be a major issue for businesses that rely on these options for their products. By integrating with Advanced Order Export For WooCommerce, store owners can export orders with all the custom product options included.

In an example, the option to select gift wrapping is already available on the product page. Thus, the customer does not need to look for it.

Using Advanced Order Export For WooCommerce integration, we can track how often customers add Gift wrapping to an order. This can be useful in making decisions regarding a product: Should the price be increased or decreased? or remove Gift wrapping altogether?

As with Tickera, you need to paste the following code into the snippet.

Note: I use code “all options as ONE row”. There are also codes “each option as column” and “each option as separate row”.

// add all options to SINGLE  product row
class WOE_add_TM_cols{
	var $tm_cols = array( 'pos','name','value','price','quantity', 'name_value'); 
	function __construct() {
		add_filter('woe_get_order_product_fields',array($this,'add_product_fields') );
		add_filter('woe_fetch_order_products', array($this,'fill_tm_cols') ,10, 5);
	}	
	
	function add_product_fields($fields) {
		foreach($this->tm_cols as $tm_col) {
			$fields['tm_field_'.$tm_col] = array('label'=>'TM '.$tm_col,'colname'=>'TM '.$tm_col,'checked'=>1);
		}	
		return $fields;
	}
	
	function fill_tm_cols($products, $order, $labels, $format,$static_vals) {
		$new_products = array();
		
		foreach( $products as $item_id=>$product) {
			$item_meta = get_metadata( 'order_item', $item_id );
			
			$pos = 1; 
			if( isset($item_meta["_tmcartepo_data"])   AND  is_array($tmfields = maybe_unserialize($item_meta["_tmcartepo_data"][0]))  ) {
				$new_product = $product;
				foreach($tmfields as $tm_field) {
					$tm_field['pos']= $pos++;//set fake field
					$tm_field['name_value'] = $tm_field['name'] . ':' .$tm_field['value'];
					// fill TM columns 
					foreach($this->tm_cols as $tm_col) {
						if( !isset($new_product['tm_field_'.$tm_col])) continue;
						if( !empty($new_product['tm_field_'.$tm_col]))
							$new_product['tm_field_'.$tm_col] .= ", " .$tm_field[$tm_col];
						else	
							$new_product['tm_field_'.$tm_col] = $tm_field[$tm_col];
					}
				}
				//don't add each option as new product!
				$new_products[] = $new_product;
				$pos++;
			}
			if( isset($item_meta["_tmcartfee_data"])   AND  is_array($tmfields = maybe_unserialize($item_meta["_tmcartfee_data"][0]))  ) {
				$new_product = $product;
				foreach($tmfields[0] as $tm_field) {
					$tm_field['pos']= $pos++;//set fake field
					$tm_field['name_value'] = $tm_field['name'] . ':' .$tm_field['value'];
					// fill TM columns 
					foreach($this->tm_cols as $tm_col) {
						if( !isset($new_product['tm_field_'.$tm_col])) continue;
						if( !empty($new_product['tm_field_'.$tm_col]))
							$new_product['tm_field_'.$tm_col] .= ", " .$tm_field[$tm_col];
						else	
							$new_product['tm_field_'.$tm_col] = $tm_field[$tm_col];
					}
				}
				//don't add each option as new product!
				$new_products[] = $new_product;
				$pos++;
			}
			if($pos==1) //nothing added - just copy product as is 
				$new_products[] = $product;
		}
		return $new_products;
	}
}	
new WOE_add_TM_cols();

Then generate a report.

Shipping Multiple Addresses

Shipping multiple addresses has become an essential plugin for e-commerce businesses, as it allows customers to ship their purchases to multiple locations with ease. This is especially useful for customers who may want to send gifts to multiple recipients or for businesses that need to fulfill orders to different addresses. Integrating this plugin with Advanced Order Export for WooCommerce takes the shipping process to the next level.

First, let’s clarify how to configure the Shipping multiple addresses plugin. After installation and activation, you will find the new “Multiple Customer Addresses Options” tab. There you need to enable the “Shipping per product” option (located at the very end of the page). After which the buyer will be able to select different shipping or billing addresses for each product at the Checkout page.

As with previous plugins, paste the following code:

//this code adds shipping information for each product
class WOE_add_product_shipping{
	var $qty_shipping, $default_address ;
	
	function __construct() {
		//add fields to export
		add_filter('woe_get_order_product_fields', array($this,'add_shipping_fields'), 10, 2);
		//remember QTY+Address for each prodct
		add_filter('woe_order_export_started',array($this,'fetch_product_shipping'), 10, 1);
		// rebuild product list based on shipping packages
		add_filter('woe_fetch_order_products',array($this,'rebuild_products_shipping'), 10, 5);
	}	
	
	function add_shipping_fields($fields,$format) {
		$names = array('first_name','last_name','full_name','company','country','address_1','address_2','city','state','postcode','note');
		foreach($names as $f) {
			$fields['shipping_'.$f] = array('label'=>"Product Shipping ".$f,'checked' => 1, 'colname'=>"Product Shipping ".$f);
		}	
		return $fields;
	}           

	function fetch_product_shipping($order_id){
		$this->qty_shipping = array();
		$shipping_packages = get_post_meta($order_id, '_wcms_packages', true );
		if( !is_array($shipping_packages) )
			$shipping_packages = array();
		foreach($shipping_packages  as $pack) {
			$addr = $pack['destination'];
			foreach($pack["contents"] as $item) {
				$key = $item['cart_key'];
				$addr['full_name'] = trim($addr['first_name'] . " " . $addr['last_name']); // new field
				$addr['note'] = isset($pack['note']) ? $pack['note'] : '';
				if( !isset($this->qty_shipping[$key]) )
					$this->qty_shipping[$key] = array();
				$this->qty_shipping[$key][] = array("qty"=>$item['quantity'],"address"=>$addr);
			}
		}               
      
		//if no pack!
		$order = new WC_Order($order_id);
		$this->default_address = array();
		$names = array('first_name','last_name','company','country','address_1','address_2','city','state','postcode');
		foreach($names as $field)
	                $this->default_address[$field] = $order->{"get_shipping_".$field}();
		$this->default_address['full_name'] = trim($this->default_address['first_name'] . " " . $this->default_address['last_name']); // new field
		$this->default_address['note'] = $order->get_customer_note();
		return $order_id;
	}

	function rebuild_products_shipping($products, $order, $labels, $format, $static) { 
		$new_products = array();
		foreach( $products as $item_id=>$row) {
			$item = $order->get_item($item_id);
			$key = $item['_wcms_cart_key'];
			if( !isset($this->qty_shipping[$key])) { // not multishipping package!
				$this->qty_shipping[$key] = array( array("qty"=>$item['qty'], 'address'=>$this->default_address) );
			}
			foreach($this->qty_shipping[$key]  as $new_row) {
				if( isset($row['qty']) )
					$row['qty'] = $new_row['qty'];
				if( isset($row['qty_minus_refund']) )
					$row['qty_minus_refund'] = $new_row['qty'];
				foreach($new_row['address'] as $k=>$v) {
					$k = 'shipping_'.$k;
					if( isset($row[$k]) )
						$row[$k] = $v; 
				}
				$new_products[]= $row;
			}
		}
		return $new_products;
	}

}	
new WOE_add_product_shipping();

Generating the report will be more difficult this time. You need to create the fields required for the report by clicking on the “Add field” button in the “Product order items” tab in the “Set up fields to export” section. Find and add the following fields as in the screenshot.

Note: Learn more about how to use the “Add field”, “Add static field” and “Add calculated field” buttons.

To get this result.

Ultimately, integrating of Advanced Order Export for WooCommerce with third-party applications can bring numerous benefits to companies. It saves time, reduces errors, and provides a comprehensive overview of all orders. This not only improves the efficiency of the business but also enhances the overall customer experience, making it a valuable tool for any e-commerce store.