3 回答

TA貢獻(xiàn)1834條經(jīng)驗(yàn) 獲得超8個(gè)贊
/**
* Register the routes for this class
*
* GET /customers/<id>/subscriptions
*
* @since 2.0
* @param array $routes
* @return array
*/
public function register_routes( $routes ) {
# GET /customers/<id>/subscriptions
$routes[ $this->base . '/(?P<id>\d+)/subscriptions' ] = array(
array( array( $this, 'get_customer_subscriptions' ), WC_API_SERVER::READABLE ),
);
return $routes;
}
你的端點(diǎn)應(yīng)該是 /customers/<id>/subscriptions- 這里<id>是customer_id
WCS API 函數(shù)獲取與特定客戶相關(guān)聯(lián)的所有訂閱。

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超10個(gè)贊
您可能不再尋找這個(gè),但我想我會(huì)澄清答案,因?yàn)?@mujuonly 不方便地遺漏了它僅適用于Legacy WooCommerce API
. 無論如何,它已被棄用。但它現(xiàn)在有效。
在 WooCommerce -> 設(shè)置 -> 高級(jí) -> 舊版 API 中啟用舊版 API
獲取您的訪問令牌
訪問
https://___.com/wc-api/v3/customers/<customer_id>/subscriptions/
截至目前,我沒有看到本機(jī) API 支持類似此端點(diǎn)的任何內(nèi)容。希望它會(huì)在不久的將來被添加。

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊
您可以使用以下方式獲得有效訂閱:
/wp-json/wc/v1/subscriptions/<id> //To get particular subscription /wp-json/wc/v1/subscriptions //To get all subscriptions
您可以在此處獲取更多信息: https ://prospress.github.io/subscriptions-rest-api-docs/?php#list-all-subscriptions
如果您覺得有幫助,請(qǐng)告訴我。
- 3 回答
- 0 關(guān)注
- 175 瀏覽
添加回答
舉報(bào)