Answer the question
In order to leave comments, you need to log in
How to add a column to users?
Hello. Tell me, there is a store on woo, you need to add such columns of payment options for each user , he chooses one of three payment options convenient for him and in the checkout, you need to display the selected payment option for each user.
Answer the question
In order to leave comments, you need to log in
Damn, well, the order is a stupidly ordinary post type, it has custom_fields with the key '_customer_user'
Accordingly , the
user's last order should be received like this
$customer_order = get_posts( array(
'numberposts' => 1,
'meta_key' => '_customer_user',
'meta_value' => $user_id,
'post_type' => wc_get_order_types( 'view-orders' ),
'post_status' => array_keys( wc_get_order_statuses() ),
'orderby' => 'ID',
'order' => 'DESC' // можно не указывать так ао умолчанию
) );
$order = wc_get_order( $customer_order );
$payment_method = $orde['payment_method']; // это крайний метод оплаты
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question