Created
July 5, 2018 17:00
-
-
Save bernattorras/efb5eabe913b442737f0e61aa83b9cfa to your computer and use it in GitHub Desktop.
Function to create pending renewal orders for given subscriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to create pending renewal orders for given subscriptions | |
**/ | |
add_action( 'init', 'create_pending_orders_for_subscriptions' ); | |
function create_pending_orders_for_subscriptions(){ | |
$subscriptions = array(76,72); | |
foreach($subscriptions as $subscription_id){ | |
$subscription = wcs_get_subscription( $subscription_id ); | |
wcs_create_renewal_order( $subscription ); | |
$subscription->add_order_note( __( 'Create pending renewal order requested by "create_pending_orders_for_subscriptions" function.', 'woocommerce-subscriptions' ), false, true ); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment