/** * Change the status of a subscription and show a notice to the * user to say when the next payment will now be made on. * * @since 1.0.0 * @access public * @static * @param $subscription * @param $order_id * @param $product_id * @uses WC_Subscriptions::add_notice */ public static function change_users_subscription($subscription, $order_id, $product_id) { $subscription = !is_object($subscription) ? wcs_get_subscription($subscription) : $subscription; $current_next_subscription_payment = WC_Subscriptions_Order::get_next_payment_date($order_id, $product_id, $from_date = ''); // Get the date of the current next subscription. $next_subscription_payment = WC_Subscriptions_Order::calculate_next_payment_date($order_id, $product_id, $type = 'mysql', $current_next_subscription_payment); WCSO_Subscriptions_Order::update_next_payment($order_id, $next_subscription_payment); // Update the next payment on the subscriptions order. $subscription->add_order_note(__('Subscription was skipped by the subscriber from their subscription page.', 'woocommerce-skip-one')); // translators: placeholder is next subscription payment WC_Subscriptions::add_notice(sprintf(__('You next payment subscription will now be on the %s.', 'woocommerce-skip-one'), $next_subscription_payment), 'success'); }
// END init /** * This updates the next payment date on the subscription order. * * @since 1.0.0 * @access public * @param $order_id * @param $next_subscription_payment */ public function update_next_payment($order_id, $next_subscription_payment) { // Need to add code here. } // END update_next_payment() /** * Subscription Skipped Next Payment * * Send the customer an email with the next payment date for the subscription. * * @since 1.0.0 * @access public * @param WC_Order|int $order The WC_Order object or ID of a WC_Order order. * @param $next_payment The new date for the next payment of the subscription. */ public function send_customer_skipped_order_email($order, $next_payment) { WCSO_Emails::send_customer_skipped_order_email($order, $next_payment); } } WCSO_Subscriptions_Order::init();