Support » Plugin: WooCommerce » Unable to insert download log entry in database.

  • Resolved jd

    (@janedilkes)


    This problem has just started. When someone tries to download a product, the error message “Unable to insert download log entry in database.” is shown, and the product is not downloaded.

    I have seen this topic, which has been marked as resolved:
    https://wordpress.org/support/topic/cannot-download-purchased-download/

    I have tried the suggestions on that topic.

    This problem is happening on all orders.

    Any idea what I can do about this?
    Thanks.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 29 total)
  • Plugin Support Shane Eckert

    (@shaneeckert)

    Automattic Happiness Engineer

    Hi janedilkes,

    If you tried the solution from the other thread, you may want to test with a default theme like Twenty Seventeen or Storefront, and disable all plugins aside from WooCommerce. If that resolves the issue, then it’s a conflict.

    jd

    (@janedilkes)

    Thanks, I’ve just tried disabling all plugins but woocommerce, and activated the twenty seventeen theme.

    Unfortunately it has not solved the problem.

    jd

    (@janedilkes)

    The error message comes from class-wc-customer-download-log-data-store.php

    In there the table name it’s trying to insert into seems to be:

    wc_download_log

    but this table is not present in my database.

    This worked okay until my hosting company moved the databases; they seem to have moved from mysql to 10.2.14-MariaDB

    The table wc_download_log was not present in the databases before they were moved, but the downloads worked okay then.

    Does anyone have any idea what I should do to make this work? Thanks.

    jd

    (@janedilkes)

    If I comment out this line in class-wc-customer-download-log-data-store.php, the download works (i.e. does not die when it can not insert the log data into the non-existent table)

    wp_die( __( ‘Unable to insert download log entry in database.’, ‘woocommerce’ ) );

    I also get this error. In my case after I pushed from Staging to Live on WPEngine.

    Modifying the source isn’t real sustainable. Is there a more durable solution?

    When I check in the back end the order is Completed. Looking at Downloadable Product Permissions it reports that the user downloaded the file twice. It was attempted, but failed twice.

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @janedilkes @chrishaff

    This sounds like there is a database permissions error, or something is blocking that.

    I haven’t heard about this before and there isn’t much to go on but I can reach out to the developers for more advice.

    Thanks

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi again @janedilkes @chrishaff

    Speaking to one of the developers, this is odd – the table should be created by the install script: https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-install.php#L738

    @chrishaff – are you missing the database table?

    Thanks,

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi all,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thanks

    jd

    (@janedilkes)

    Hi,

    I have created the table but I still get the error so have had to comment out the line again.

    Thanks.

    jd

    (@janedilkes)

    When I created the table from the script, I did not add the correct prefix. With the table correctly named this has solved this problem.

    Thanks for your help.

    • This reply was modified 2 years, 2 months ago by jd.

    Hi @janedilkes @dougaitken, I am having the same problem with the wp_wc_download_log table not uploading with WooCommerce. i have tried everything to get it to work. Im not that tech and dont understand code. I see you created the table. Are you able to share that table with me please? I have no idea what it is. And if you can share the table with me, where and how do I install it? I have spent months working on my website and if I dont have the ability for customers to download the digital files then I will have to start over again on a new host. By the way my host Media Temple has been no help at all. Cheers.

    jd

    (@janedilkes)

    Hi @noosag,

    There was a link further up this thread to the table creation script:

    https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-install.php#L738

    Find within that script the section that creates the download_log table, then run that part of the script to create the table in your database.

    You may need to then rename the table to add the correct prefix, which will be the same prefix as all the other woocommerce tables in your database.

    I hope this works for you.

    Thanks @janedilkes, can you tell me where abouts I would go to find this script please? Is it in my phpMyAdmin settings? I really have no idea to be looking sorry.

    Hi there, have you solved this error?
    I have the same issue now and nothing is working!
    I always get the same » “Unable to insert download log entry in database.
    ” Message 🙁

    I am having the same issue as well, but I do see the table in the database:

    wc_download_log

    The strange thing is that it was working fine while under development on a subdomain and after launching to the main domain, now it doesn’t work. It still works on the development site. I’m trying to figure out what is different.

Viewing 15 replies - 1 through 15 (of 29 total)
  • You must be logged in to reply to this topic.