WordPress.org

Support

Support » Plugins and Hacks » Woocommerce not calculating tax woo_debug shows join error

Woocommerce not calculating tax woo_debug shows join error

  • I get these errors made them bold. This shows in WP_DEBUG.

    SELECT * FROM (
    SELECT tax_rates.* FROM
    wp_woocommerce_tax_rates as tax_rates
    LEFT OUTER JOIN
    wp_woocommerce_tax_rate_locations as locations ON tax_rates.tax_rate_id = locations.tax_rate_id
    LEFT OUTER JOIN
    wp_woocommerce_tax_rate_locations as locations2 ON tax_rates.tax_rate_id = locations2.tax_rate_id
    WHERE
    tax_rate_country IN ( ‘US’, ” )
    AND tax_rate_state IN ( ‘CA’, ” )
    AND tax_rate_class = ”
    AND
    (
    (
    locations.location_type IS NULL
    )
    OR
    (
    locations.location_type = ‘postcode’
    AND locations.location_code IN (‘*’,”)
    AND locations2.location_type = ‘city’
    AND locations2.location_code = ”
    )
    OR
    (
    locations.location_type = ‘postcode’
    AND locations.location_code IN (‘*’,”)
    AND 0 = (
    SELECT COUNT(*) FROM wp_woocommerce_tax_rate_locations as sublocations
    WHERE sublocations.location_type = ‘city’
    AND sublocations.tax_rate_id = tax_rates.tax_rate_id
    )
    )
    OR
    (
    locations.location_type = ‘city’
    AND locations.location_code = ”
    AND 0 = (
    SELECT COUNT(*) FROM wp_woocommerce_tax_rate_locations as sublocations
    WHERE sublocations.location_type = ‘postcode’
    AND sublocations.tax_rate_id = tax_rates.tax_rate_id
    )
    )
    )
    GROUP BY
    tax_rate_id
    ORDER BY
    tax_rate_priority, tax_rate_order
    ) as ordered_taxes
    GROUP BY
    tax_rate_priority

    The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay

    SELECT * FROM (
    SELECT tax_rates.* FROM
    wp_woocommerce_tax_rates as tax_rates
    LEFT OUTER JOIN
    wp_woocommerce_tax_rate_locations as locations ON tax_rates.tax_rate_id = locations.tax_rate_id
    LEFT OUTER JOIN
    wp_woocommerce_tax_rate_locations as locations2 ON tax_rates.tax_rate_id = locations2.tax_rate_id
    WHERE
    tax_rate_country IN ( ‘US’, ” )
    AND tax_rate_state IN ( ‘CA’, ” )
    AND tax_rate_class = ”
    AND
    (
    (
    locations.location_type IS NULL
    )
    OR
    (
    locations.location_type = ‘postcode’
    AND locations.location_code IN (‘*’,”)
    AND locations2.location_type = ‘city’
    AND locations2.location_code = ”
    )
    OR
    (
    locations.location_type = ‘postcode’
    AND locations.location_code IN (‘*’,”)
    AND 0 = (
    SELECT COUNT(*) FROM wp_woocommerce_tax_rate_locations as sublocations
    WHERE sublocations.location_type = ‘city’
    AND sublocations.tax_rate_id = tax_rates.tax_rate_id
    )
    )
    OR
    (
    locations.location_type = ‘city’
    AND locations.location_code = ”
    AND 0 = (
    SELECT COUNT(*) FROM wp_woocommerce_tax_rate_locations as sublocations
    WHERE sublocations.location_type = ‘postcode’
    AND sublocations.tax_rate_id = tax_rates.tax_rate_id
    )
    )
    )
    GROUP BY
    tax_rate_id
    ORDER BY
    tax_rate_priority, tax_rate_order
    ) as ordered_taxes
    GROUP BY
    tax_rate_priority

    The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay

    http://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Fixed I had to use $wpdb->query(‘SET SQL_BIG_SELECTS=1’); on line 91 of class-wc-tax.php.

    This error was caused based on the size of the rates table. Using all of CA state rates was a total of 2596 when there were a few it worked fine. Maybe this fix could be added to an update in the future.

Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce not calculating tax woo_debug shows join error’ is closed to new replies.