autoship_create_scheduled_order_data

(src/orders.php) Part of the autoship_create_scheduled_orders() function. Allows developers to add or alter Scheduled Order Data before it is saved on creation or after Scheduled Order processing. It takes the $scheduled_order_data and the (WooCommerce) $order_id as its parameters.

See also how this filter can be used to add Autoship Coupons to Scheduled Orders created at checkout.

See also how this filter can be used to add affiliate metadata to a Scheduled Order created at checkout.

Code

$scheduled_order_data = apply_filters( 'autoship_create_scheduled_order_data', $scheduled_order_data, $order_id );

Example

/**
 * @param: array $scheduled_order_data
 * @param: int $order_id
 * @return array
 */
function autoship_create_scheduled_order_data_example( $scheduled_order_data, $order_id ) {
	$scheduled_order_data['my_custom_field'] = 'my_custom_value';
	return $scheduled_order_data;
}
add_filter( 'autoship_create_scheduled_order_data', 'autoship_create_scheduled_order_data_example', 10, 2);

Still need help? Contact Us Contact Us