kreamweb
6/26/2018 - 2:42 PM

[subscription] Compatibility with WooCommerce Extra Checkout Fields for Brazil

<?php 

if ( function_exists( 'ywsbs_get_subscription' ) ) {
	add_action( 'ywsbs_renew_subscription', 'ywsbs_renew_subscription_additional_fields', 10, 2 );
	function ywsbs_renew_subscription_additional_fields( $renew_order_id, $subscription_id ) {
		$subscription = ywsbs_get_subscription( $subscription_id );
		$order_id     = $subscription->order_id;
		$billing_persontype   = get_post_meta( $order_id, '_billing_persontype', true );
		$billing_cpf   = get_post_meta( $order_id, '_billing_cpf', true );

		update_post_meta( $renew_order_id, '_billing_persontype', $billing_persontype );
		update_post_meta( $renew_order_id, '_billing_cpf', $billing_cpf );
	}
}