Snippets

Visser Labs Adding static Order Item fields to the Orders export type

Created by Michael Visser last modified
<?php
function custom_woo_ce_order_fields( $fields ) {

	$fields[] = array(
		'name' => 'order_items_static',
		'label' => __( 'Order Items: Static Field', 'woo_ce' ),
		'hover' => __( 'Custom Field within functions.php', 'woo_ce' )
	);
	return $fields;

}
add_filter( 'woo_ce_order_fields', 'custom_woo_ce_order_fields' );

function custom_woo_ce_extend_order_item( $order_item = array(), $order_id = 0 ) {

	$order_item->static = 'Static value';

	return $order_item;

}
add_filter( 'woo_ce_order_item', 'custom_woo_ce_extend_order_item', 10, 2 );
?>

Comments (0)