首页 > 解决方案 > 如何在 woocommerce 中检查订单备注的类型

问题描述

如何查看订单备注的类型woocommerce

我想检查笔记是 private_note 还是 customer_note。

这是我的代码:

//add_action('wp_insert_comment','hook_insert_func',100,2);
add_filter( 'comments_clauses','hook_insert_func',100,2);
function hook_insert_func($id, $comment){

    if($comment->comment_type!='order_note')
    return;

    if($comment->comment_type == 'order_note'){
            $mobile  = PWooSMS()->buyerMobile($comment->comment_post_ID);

            $data            = array();
            $data['type']    = 1;
            $data['mobile']  = "$mobile";
            $data['message'] = $comment->comment_content;
            $response = PWooSMS()->SendSMS( $data );
    }
}

标签: wordpresswoocommerce

解决方案


推荐阅读