• 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

Laravel Collections. Is there some kind of assertStructure method?

Why the name of trucks are same in 2nd and 3rd record of company data retrieval?

how to loop through json response data using ajax jquery?

WordPress Subquery returns more than 1 row on SELECT

How to identify whether webp image is static or animated?

How to create a individual template for page or post in custom plugin?

Popup Window and PHP form

shell errors running php exec

Woocommerce redirect after add-to-cart error

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

how to validate form data in codeigniter 4

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

Timber: Single post pagination does not work (wp_link_pages)

How to delete old images from public folder on update using Laravel

PHP contact form configuration [duplicate]

About Contact Privacy policy Terms and conditions