• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Updating and Synchronizing Woocommerce Subscriptions to Custom Date

phpwordpresswoocommercewoocommerce-subscriptions


PHP Snippet 1:

function push_subscriptions_to_next_week($subscription, $order, $recurring_cart) {
    // The new date calculation of +7 days is just an example
    $new_dates = array(
        'start' => date('Y-m-d H:i:s', strtotime('+7 days', time())),
        'next_payment' => date('Y-m-d H:i:s', strtotime('+7 days', time()))
    );

    $subscription->update_dates($new_dates, 'site');
}

add_action( 'woocommerce_checkout_subscription_created', 'push_subscriptions_to_next_week', 10, 3);

Related Snippets

How to insert data from multiple select dropdown values into database?

Distribute array row data to make multiple new rows

(Cache::lock()) -> get() -- Under what conditions does it return false?

Symfony run hint kernel.secret parameter not found

Laravel PHP: multiple project run at the same time [closed]

Change user role if checkout custom checkbox is checked in WooCommerce

Check if user online laravel

Make survey at laravel 5.4 and MySQL

Send Outlook 2010 email using PHP

Redirect to previous page with php

WooCommerce - unset "<product> removed notice…" on cart page

Laravel Displaying image from database

Laravel views are showing from cache on one server but works fine on other server

Edit XML in HTML form and submit to self

Display a success custom notice after Placing an Order in WooCommerce

About Contact Privacy policy Terms and conditions