• Resolved weedave

    (@weedave)


    I’m using Woo commerce with subscriptions, latest versions.

    I’m trying to set a renewal time on a subscription to 11pm straight after its been created.
    I keep getting an internal server errors and not so familiar with debugging them, $debug is set to true in wp-config.

    I’m using snippets to insert the action hook.

    Is this the correct approach to this?

    add_action( 'woocommerce_checkout_subscription_created', 'change_renewal_day', 10, 3 );
    
    function change_renewal_day ($subscription, $order, $recurring_cart) {
    	if($subscription->can_date_be_updated('next_payment')){
    		$newdate = new DateTime(strtotime($subscription->get_date('nextpayment')));
    		$newdate.settime(23,00);
    		/*
    		$subscription::update_dates(
    			array('start' => $subscription::get_date('start'),
    				 'trial_end'=>$subscription::get_date('trialend'),
    				 'next_payment'=>$newdate->format('Y-m-d H:i:s'),
    				 'last_payment'=>$subscription::get_date('last_payment')
    				 )
    		);*/
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Joey – a11n

    (@jricketts4)

    Hi @weedave – This forum is for WooCommerce core questions, so it’s not a good place for paid extensions. Unfortunately, your question is also out of scope for our support team (custom code), so I’m going to leave this open for a bit for you to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Thanks!
    – Joey

    It looks like you may have found a solution to this. I am going to mark this as Resolved at this time. If you have another issue please feel free to open a new post. ??

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change renewal time on subscription’ is closed to new replies.