我的结账表格非常简单,我不注册客户,也没有收到电子邮件,我只有帐单电话号码。 那么我如何使用账单电话号码检查客户是否返回?
无论客户下单多少次,只要电话号码相同,就应该在后台的订单列表页面添加一个标签或栏目,表明该订单是来自回头客的订单。
我自己解决了这个问题。 如果有人需要帮助,这里是代码
add_action( 'manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 50, 2 );
function custom_orders_list_column_content( $column, $post_id ) {
if ( $column == 'order_number' )
{
global $the_order, $wpdb;
if( $phone = $the_order->get_billing_phone() ){
$results = $wpdb->get_results('select * from `C2R_postmeta` where meta_key = "_billing_phone" and meta_value = "'.$phone.'"');
if ( count($results) > 1 ) {
echo '<span class="return-customer">Returing</span>';
}
$phone_wp_dashicon = '<span class="dashicons dashicons-whatsapp"></span> ';
echo '<a href="https://wa.me/+92'.$phone.'" target="_blank">' . $phone_wp_dashicon . $phone.'</a></strong>';
}
}
}
这是结果
样式代码在这里
span.return-customer {
display: inline-block;
background: #ffff58;
padding: 2px 7px;
border: 1px solid #eee;
border-radius: 6px;
font-size: 10px;
line-height: 1.5;
font-weight: 500;
margin-left: 5px;
letter-spacing: 1px;
text-transform: uppercase;
color: #000;
}