• Resolved jjbte

    (@jjbte)


    Now that WordPress is using utf8mb4 collation by default, there is a problem with the creation of the woocommerce_tax_rate_locations table upon WooCommerce plugin activation. The table is not created due to the following error:

    WordPress database error Specified key was too long; max key length is 1000 bytes for query
    CREATE TABLE wp_woocommerce_tax_rate_locations (
      location_id bigint(20) NOT NULL auto_increment,
      location_code varchar(255) NOT NULL,
      tax_rate_id bigint(20) NOT NULL,
      location_type varchar(40) NOT NULL,
      PRIMARY KEY  (location_id),
      KEY tax_rate_id (tax_rate_id),
      KEY location_type (location_type),
      KEY location_type_code (location_type,location_code)
    ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

    To get the table to install, I have to perform the installation manually with the following modified code (changes size of location_code key to 191):

    CREATE TABLE IF NOT EXISTS wp_woocommerce_tax_rate_locations (
      location_id bigint(20) NOT NULL AUTO_INCREMENT,
      location_code varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
      tax_rate_id bigint(20) NOT NULL,
      location_type varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
      PRIMARY KEY (location_id),
      KEY tax_rate_id (tax_rate_id),
      KEY location_type (location_type),
      KEY location_type_code (location_type,location_code (191))
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

    Another option would be to force another collation, such as utf8_unicode_ci or utf8_general_ci.

    I hope there are plans to address this issue in the next update.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 5 replies - 16 through 20 (of 20 total)
  • No i havent. Maybe you can since your are the author you will get a faster response. Cheers for the help.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I don’t have access to their support area, I’m not a customer ??

    Hi, I have the same problem (tax is always zero).
    I’ve tried every setting – to no avail.

    And there are quite a few posts on checking whether your tax table exists (and how to create one) … but none of them say where that could should be entered.
    ??

    I have access to my SQL in my hosting control panel – but which php file should I be looking at ?

    Or which part of the WooCommerce plugin should I be editing in my WordPress back-office / control-panel ?

    Thanks.

    ??

    Thread Starter jjbte

    (@jjbte)

    Perchie, many web hosts provide access to MySQL databases via an application called phpMyAdmin. If you do not have that, you’ll need to consult your web hosting provider to find out how to access your databases.

    The table you need to check for is {your_wp_table_prefix}_woocommerce_tax_rate_locations. For me and others, that was the missing table that caused our tax issues. If that table is missing, it needs to be created through phpMyAdmin or whatever MySQL tool you have. See my first post at the top of this thread (the “wp_” table prefix would need to be replaced by your own table prefix).

    However, I believe this issue was resolved some time ago, so this may not be the cause of your particular problem. It also sounds like you are not really familiar with MySQL. If that is the case, I suggest you seek your web hosting provider’s assistance with this issue.

    @ jjbte – Thankyou very much. I’ll take a look at that.

    ??

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Error Creating woocommerce_tax_rate_locations table’ is closed to new replies.