고객과 관련된 woocommerce 질문. $ order 객체 내의 데이터를 사용할 수 없더라도 비슷한 게시물이 있습니다.고객 세부 사항
Get customers name in Woocommerce
문제 : 나는 고객 정보 얻을 필요 (모든 고객 - 또는 한 번에 기록) 구입 및 관리 주문 상태 변화에 실시간으로.
예. 로그인 한 고객이 제품을 구매하지 않습니다. 제품 상태가 '완료'되면 내가 주문 ID와 주문에 관한 대부분의 물건을 검색 할 수있는이 작업을 잡아이 시점에서 기능
add_action('woocommerce_order_status_completed', 'woocommerce_payment_completed');
내에서 뭔가. 고객의 세부 사항이 나를 도망 칩시 다.
고객이 로그인 한 경우 $ user_id를 사용할 수 있지만 사이트에 계정이없는 경우 어디서 이름/이메일을받을 수 있습니까?
boolean false
object(WC_Customer)[106]
protected '_data' =>
array (size=14)
'country' => string 'AU' (length=2)
'state' => string '' (length=0)
'postcode' => string '' (length=0)
'city' => string '' (length=0)
'address' => string '' (length=0)
'address_2' => string '' (length=0)
'shipping_country' => string 'AU' (length=2)
'shipping_state' => string '' (length=0)
'shipping_postcode' => string '' (length=0)
'shipping_city' => string '' (length=0)
'shipping_address' => string '' (length=0)
'shipping_address_2' => string '' (length=0)
'is_vat_exempt' => boolean false
'calculated_shipping' => boolean false
private '_changed' => boolean false
object(WC_Order)[134]
public 'id' => int 44
public 'order_type' => string 'simple' (length=6)
public 'prices_include_tax' => boolean true
public 'tax_display_cart' => string 'incl' (length=4)
public 'display_totals_ex_tax' => boolean false
public 'display_cart_ex_tax' => boolean false
public 'post' =>
object(WP_Post)[132]
public 'ID' => int 44
public 'post_author' => string '1' (length=1)
public 'post_date' => string '2014-11-25 05:07:55' (length=19)
public 'post_date_gmt' => string '2014-11-25 05:07:55' (length=19)
public 'post_content' => string '' (length=0)
public 'post_title' => string 'Order – November 25, 2014 @ 05:07 AM' (length=42)
public 'post_excerpt' => string '' (length=0)
public 'post_status' => string 'wc-on-hold' (length=10)
public 'comment_status' => string 'open' (length=4)
public 'ping_status' => string 'closed' (length=6)
public 'post_password' => string 'order_54740eab99424' (length=19)
public 'post_name' => string 'order-nov-25-2014-0507-am' (length=25)
public 'to_ping' => string '' (length=0)
public 'pinged' => string '' (length=0)
public 'post_modified' => string '2014-11-25 05:07:55' (length=19)
public 'post_modified_gmt' => string '2014-11-25 05:07:55' (length=19)
public 'post_content_filtered' => string '' (length=0)
public 'post_parent' => int 0
public 'guid' => string 'http://essential.localtest.me/?post_type=shop_order&p=44' (length=61)
public 'menu_order' => int 0
public 'post_type' => string 'shop_order' (length=10)
public 'post_mime_type' => string '' (length=0)
public 'comment_count' => string '2' (length=1)
public 'filter' => string 'raw' (length=3)
public 'order_date' => string '2014-11-25 05:07:55' (length=19)
public 'modified_date' => string '2014-11-25 05:07:55' (length=19)
public 'customer_message' => string '' (length=0)
public 'customer_note' => string '' (length=0)
public 'post_status' => string 'wc-on-hold' (length=10)
public 'shipping_address' => string 'anothe address, Sydney, NSW, 2011, AU' (length=37)
public 'billing_address' => string 'anothe address, Sydney, NSW, 2011, AU' (length=37)
편집 :
몇 가지 시도는 ... 여기
$order->get_user(), new WC_Customer(), $order itself.
결과의 출력입니다 !!!! Wordpress에 대한 나의 지식은 여전히 초보자 인 것 같습니다. 데이터가 wp_postmeta 테이블에 저장되어있는 것으로 보입니다. 이 데이터는 접근 가능하고 (어떻게 든), 찾고있는 필드 (또는 meta_key)는 _billing_first_name, _billing_last_name은 $ order-> billing_last_name; etc ... $ order가 유효한 주문 ID를 가진 WC_Order() 객체라고 가정하십시오.
http://stackoverflow.com/questions/17819054/get-customers-name-in-woocommerce ... 죄송합니다, 추상 클래스는 아마 '내가 나오지 않았어 몇 가지 변수가 보인다 보지마 .... 이것은 아마도 내가 어디에서나 멤버 변수로 billing_email을 볼 수는 없지만 계속해야하는 곳일 까닭이 무엇입니까 ??? –