How to get Order Details from a WC_Subscription instance Object

后端 未结 2 1707
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 12:08

This one for completed initial subscription payments and subscription renewals.

function payment_made($subscription){
    // How do I get the order details?
}
add         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-26 13:06

    Some details can be obtained directly from the WC_ subscription object using the following methods

     $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()
    

提交回复
热议问题