4

ドキュメントは非常に少ないです。WooCommerce サブスクリプション (WooCommerce のプラグイン) API を使用して、サブスクリプションのリストと各サブスクリプションのすべての詳細を取得するコードを作成しようとしています。そこにあるドキュメントと例は、非常に少なくて弱いので、正しく理解できません。次のコードはエラーを生成しませんでしたが、サブスクリプションを出力していません (空白のページのみ)。すべてのサブスクリプションのすべての詳細を一覧表示するにはどうすればよいですか?

<?php

if(isset($_REQUEST['Action']))
{
    $Action = $_REQUEST['Action'];
    switch($Action)
    {
        case "ValidateSubscription":
            chdir("../wp-content/plugins/woocommerce-subscriptions/classes");
            include '../../woocommerce/woocommerce.php';
            //include '../woo-includes/woo-functions.php';
            //include '../woo-includes/class-wc-dependencies.php';
            include 'class-wc-subscriptions-manager.php';

            $Subscriptions = WC_Subscriptions_Manager::get_all_users_subscriptions();
            print_r($Subscriptions);
            break;
        default:
            echo "invalid action";
    }
}else
{
    echo "no action specified";
}
4

2 に答える 2