• 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

Check If array is null or not in php

PHPExcel export HTML table to xlsx

Laravel Route issues with Route order in web.php

Warning: sqlite_query() expects parameter 1 to be resource, string given

Form repeater send wrong data with last element in Laravel

Combining a describing and one array with data

Whats the point of running Laravel with the command 'php artisan serve'?

Laravel 5 controller sending JSON integer as string

The difference when using if statement true === something() vs something() === true [duplicate]

Valet, Xdebug after reboot Big Sur not working

Losing session data after POST from third party website

How to add a sidebar to Woocommerce Shop Page?

PHP Discord OAUTH2 code sample not working

Send same name multiple checkbox values via ajax

WooCommerce Subscriptions: Remove role on cancelled subscription

About Contact Privacy policy Terms and conditions