M
M
MalGym2019-01-17 18:03:22
WordPress
MalGym, 2019-01-17 18:03:22

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.
5c409930b621c543247424.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WP Panda, 2019-01-17
@wppanda5

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'];  // это крайний метод оплаты

Well, how to add a column in Google is just a million explanations, and how to display what you are looking for there, I indicated above

P
Pychev Anatoly, 2019-01-18
@pton

Here's how to add a column. Yesterday came by subscription

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question