2 回答
TA贡献1810条经验 获得超5个赞
要从对象获取订单详细信息WC_Subscription
,您首先需要使用以下方法获取父 ID(即订单 ID)get_parent_id()
:
$order_id = $subscription->get_parent_id();
然后,您将使用以下命令从订单 ID 获取 WC_Order 对象:
$order = wc_get_order( $order_id );
TA贡献1936条经验 获得超6个赞
可以使用以下方法直接从 WC_ 订阅对象获取一些详细信息
$subscription->get_id() //subscription id
$subscription->get_parent_id() //order id
$subscription->get_currency()
$subscription->get_customer_note()
$subscription->get_prices_include_tax()
$subscription->get_payment_method()
$subscription->get_payment_method_title()
$subscription->get_billing_first_name()
$subscription->get_billing_last_name()
$subscription->get_billing_company()
$subscription->get_billing_address_1()
$subscription->get_billing_address_2()
$subscription->get_billing_city()
$subscription->get_billing_state()
$subscription->get_billing_postcode()
$subscription->get_billing_country()
$subscription->get_billing_email()
$subscription->get_billing_phone()
$subscription->get_shipping_first_name()
$subscription->get_shipping_last_name()
$subscription->get_shipping_company()
$subscription->get_shipping_address_1()
$subscription->get_shipping_address_2()
$subscription->get_shipping_city()
$subscription->get_shipping_state()
$subscription->get_shipping_postcode()
$subscription->get_shipping_country()
$subscription->get_order_key()
$subscription->get_date_created()
$subscription->get_date_modified()
- 2 回答
- 0 关注
- 135 浏览
添加回答
举报