## wordpress woocomerce subscriptions and Membership error

Question

I am adding the custom code in the function create_subscription ()

here is the code which gives the error ,,,I have mentioned in comments which line gives the error

$renewal = wcs_order_contains_renewal($parent_order->get_id());
if ($renewal == false) { if ($trial_length > 0) {
$dates = array( 'trial_end' =>$next_payment,
'next_payment' => $next_payment, ); try {$subscription->update_dates($dates); //this code line gives the error it works fine if I comment this line } catch (Exception$e) {
f24_write_data_to_file('Error in updating Trial end date ');
f24_write_data_to_file($dates); } } } WC_Subscriptions_Manager::activate_subscriptions_for_order($parent_order);

$this->subscription =$subscription;

// On order created.
do_action('paywall/wc_subscription_created', $subscription); return$subscription;


and here is the error which I got ,,, I am using the woocommerce subscriptions plugin and Woocommerce Membership Plugin, Need help now, how to fix the error while updating the trial_end date?

0
1 year 2020-07-17T06:11:20-05:00 0 Answers 60 views 0