WordPress.org

Ready to get started?Download WordPress

Forums

Cart66 Lite :: WordPress Ecommerce
Bug report v1.5.1.14: international countries calculating taxes (1 post)

  1. clojel
    Member
    Posted 6 months ago #

    Symptom:
    Zero tax recorded with orders placed under following conditions:

    • Flat tax for "All Sales" added (Settings|Tax)
    • New order(s) involved ship-to country that has no state, eg Singapore

    Possible bug: in models/Cart66TaxRate.php, loadByState function, a new if statement was added in v1.5.1.14, enclosing original if...else statement:

    public function loadByState($state) {
        $isLoaded = false;
    
        if(strlen($state) > 2) {
          $state = strlen($this->getStateAbbreviation($state)) > 1 ? $this->getStateAbbreviation($state) : false;
        }
        <strong>if($state) { // added in cart66-lite v1.5.1.14</strong>
          $state = strtoupper($state);
    
          $sql = "SELECT * from $this->_tableName where state='$state'";
          if($row = $this->_db->get_row($sql, ARRAY_A)) {
            $this->setData($row);
            $isLoaded = true;
          }
          else {
            $sql = "SELECT * from $this->_tableName where state='All Sales'";
            if($row = $this->_db->get_row($sql, ARRAY_A)) {
              $this->setData($row);
              $isLoaded = true;
            }
          }
        <strong>} // end if($state)</strong>
    
        return $isLoaded;
      }

    For countries without state, $state would be a empty/null string. The code would skip else statement for 'All Sales', returning false regardless of 'All Sales' tax. In my case (Singapore), views/paypal-express.php (line 265-279) always return zero tax for local orders.

    Possible fix (tested):
    Close the if statement earlier.

    public function loadByState($state) {
        ...
        if($state) { // added in cart66-lite v1.5.1.14
          $state = strtoupper($state);
        } // end if($state) -- moved up
        ...
        return $isLoaded;
      }

    Please verify.
    Hopefully, this patch would be considered for the next release.

    http://wordpress.org/plugins/cart66-lite/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.