Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Chris Klosowski

    (@cklosows)

    Just to make sure I’m clear what items are you looking to get?

    The Email address of the purchaser
    The product ID purchased
    and
    The State the customer is from? or the state of the purchase (complete, pending, etc)?

    I’m not positive this data will not be retrievable in a single query due to some of the data being serialized. But we may be able to get you a snippet that will get you some of the data in PHP.

    Thread Starter TATAR

    (@tatar)

    hi.
    i want to add purchased label for customers comment.
    plz see this picture:
    https://postimg.org/image/yehlo19mt/
    …………………………………….
    for any post,i use one product id with custom field.
    how add this label to customers comment that purcased product?
    thanks

    Thread Starter TATAR

    (@tatar)

    any help me?

    Plugin Author Chris Klosowski

    (@cklosows)

    I believe we have a snippet that does something close to this. Let me find it, and modify it for your needs. There isn’t quite a direct Database query that would solve this but we’ve made some functions to get close.

    I’ll post back in a bit when I’ve got it working.

    Plugin Author Chris Klosowski

    (@cklosows)

    What is the custom field name that you are using for the post?

    Thread Starter TATAR

    (@tatar)

    hi. i create custom field and get it for every post with:

    $meta_sale_edd_number = get_post_meta($post->ID, 'meta_sale_edd_number', true);
    .
    For example, I’ve added products by ID 2255 ( post_type id)
    $meta_sale_edd_number = 2255
    This ID is used only for a single entry.

    Plugin Author Chris Klosowski

    (@cklosows)

    Ok Tatar,

    This function should be able to work for you. I’ve made it as a custom plugin, so just copy the contents of this Gist to your plugins folder into a new file, activate the plugin, then you can use the edd_ck_commenter_has_purcahsed function in your theme or code.

    https://gist.github.com/cklosowski/00ac09551933912137af

    How I tested was I activated the plugin, and then added this function to the comment callback in my theme to verify that if a commenter has purchased the specified meta ID, it returns true or false.

    As a note, this isn’t the most performant way, as it runs multiple select queries, but it is faster than the number of JOIN queries we’d have to make to get this data in a single query.

    Thread Starter TATAR

    (@tatar)

    thanks.I’m going to test

    Thread Starter TATAR

    (@tatar)

    thanks.it Well works

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘get email and product id purchase in database’ is closed to new replies.