Get WooCommerce Subscription without WordPress

I am trying to get the subscription information from the WordPress’s WooCommerce plugin, but I don’t want to load the crazy load of files that WP loads and slows down the server. What I currently use is as follows:

$subscription = false;
$result = WC_Subscriptions_Manager::get_users_subscriptions( $userID );
foreach ($result as $key => $value) {       
    if ($result[$key]["status"]=="active") $subscription = true;
}

But is there any way, will I be able to do it without including the following crazy code:

Read More
require('wp-load.php');

I just wanna connect to the DB and find out something. What I have now in WooCommerce entry for me is a big text chunk of:

a:1:{s:7:"609_222";a:11:{s:10:"product_id";s:3:"22";s:9:"order_key";s:19:"order_5396dcccd4049";s:8:"order_id";i:609;s:10:"start_date";s:19:"2014-06-10 10:37:51";s:11:"expiry_date";i:0;s:8:"end_date";i:0;s:6:"status";s:6:"active";s:17:"trial_expiry_date";i:0;s:15:"failed_payments";i:0;s:18:"completed_payments";a:1:{i:0;s:19:"2014-06-10 10:37:52";}s:16:"suspension_count";i:0;}}

I have no clue on how to get this piece of code working without using wp-load.php. Any heads up?

Related posts

Leave a Reply

2 comments

  1. Example query, edit for wherever woocommerce resides.

    <?php
    require 'wp-config.php';
    $link = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
    if (!$link) die('Could not connect: ' . mysql_error());
    mysql_select_db(DB_NAME,$link);
    $r = mysql_query("SELECT * FROM wp_options WHERE option_name = '_site_transient_update_core'");
    $a = mysql_fetch_assoc($r);
    $data = unserialize($a['option_value']);
    print_r($data);
    ?>