'How to Subscription details from the wcs_get_subscriptions_for_order() function

I have this variable:

$subscriptions = wcs_get_subscriptions_for_order($order_id, array('order_type' => 'parent'));

Using this print_r() I can see lots of data:

echo '<pre>';
print_r($subscriptions);
echo '</pre>';

How can I get some specific data like when the next payment date, when a user purchased the product, which product etc?

Is there any way?



Solution 1:[1]

$subscriptions-> get_date_created() , $subscriptions->get_items(), $subscriptions->get_status() $subscription->get_date( 'next_payment' ) Subscription is extended from WC_Order class. All the functions available for the order object are also available for the subscription object

https://woocommerce.com/document/subscriptions/develop/functions/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1