文档非常稀缺。我正在尝试创建一些使用 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";
}