corsonr
2/11/2015 - 11:15 AM

Fix Shipment Tracking / Subscriptions issue

Fix Shipment Tracking / Subscriptions issue

/**
 * Don't transfer Shipment Tracking meta when creating a renewal order.
 *
 * @access public
 * @param array $order_meta_query MySQL query for pulling the metadata
 * @param int $original_order_id Post ID of the order being used to purchased the subscription being renewed
 * @param int $renewal_order_id Post ID of the order created for renewing the subscription
 * @param string $new_order_role The role the renewal order is taking, one of 'parent' or 'child'
 * @return void
 */
public function wcst_remove_renewal_order_meta( $order_meta_query, $original_order_id, $renewal_order_id, $new_order_role ) {
    $order_meta_query .= " AND 'meta_key' NOT IN ( '_tracking_meta_key' ) ";
    return $order_meta_query;
}
add_filter( 'woocommerce_subscriptions_renewal_order_meta_query', 'wcst_remove_renewal_order_meta' ), 10, 4 );