Title: bfarnam's Replies | WordPress.org

---

# bfarnam

  [  ](https://wordpress.org/support/users/bfarnam/)

 *   [Profile](https://wordpress.org/support/users/bfarnam/)
 *   [Topics Started](https://wordpress.org/support/users/bfarnam/topics/)
 *   [Replies Created](https://wordpress.org/support/users/bfarnam/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/bfarnam/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/bfarnam/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/bfarnam/engagements/)
 *   [Favorites](https://wordpress.org/support/users/bfarnam/favorites/)

 Search replies:

## Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611474)
 * [@mikejolley](https://wordpress.org/support/users/mikejolley/)
 * I made the changes as outlined on GitHub. And… Yes It Works! Thank You!
 * Will this be rolled into an update soon or should I go ahead and make the changes
   to my other websites that I host as well?
 * Brett
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] Time Of Order](https://wordpress.org/support/topic/time-of-order/)
 *  [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/time-of-order/#post-4624680)
 * FYI, the order time is still displayed in the order details if you click on the
   order number . . .
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] how to reset sales status](https://wordpress.org/support/topic/how-to-reset-sales-status/)
 *  [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/how-to-reset-sales-status/#post-4630412)
 * If you delete the prior sales orders and then go to the order “trash” and permanently
   delete them, everything resets.
 * All of the sales graphs and sales logs are generated dynamically. You might need
   to clear your browser cache if you still get order sales data.
 * Is this what you were asking?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611457)
 * [@mikejolley](https://wordpress.org/support/users/mikejolley/), Have we had any
   luck on this?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611385)
 * I don’t know if this helps, but I did some more digging . . .
 * I changed line 366 and added a log entry under neath:
 *     ```
       $paypal_args['tax_cart'] = $order->get_total_tax();
       $this->log->add( 'paypal', 'Tax Cart '. $paypal_args['tax_cart'] . ' Tax Order ' . $order->get_total_tax() );
       ```
   
 * The log now shows:
 * `02-15-2014 @ 15:30:51 - Tax Cart 1.28 Tax Order 1.28`
 * And this is different from the cart . . . see above pic.
 * So PayPal is doing what it is supposed to do and paying what it is being told
   to pay by the plugin. The plugin is disconnected somewhere and not coming up 
   with the same amounts as show in the cart . . .
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611335)
 * I do not have reduced rate or zero rate tax
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611333)
 * [http://cryptohampster.com/wp-content/uploads/2014/02/tax1.png](http://cryptohampster.com/wp-content/uploads/2014/02/tax1.png)
 * [http://cryptohampster.com/wp-content/uploads/2014/02/tax2.png](http://cryptohampster.com/wp-content/uploads/2014/02/tax2.png)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611328)
 * Hello, Yes, sorry for the confusion.
 * Yes the amounts differ from the order itself as viewed in the order details or
   even in the shopping cart.
 * Also I just tested it, it does not matter if “Round tax at subtotal level, instead
   of rounding per line” is checked (on) or unchecked (off).
 * [http://cryptohampster.com/wp-content/uploads/2014/02/cart.png](http://cryptohampster.com/wp-content/uploads/2014/02/cart.png)
 * [http://cryptohampster.com/wp-content/uploads/2014/02/checkout.png](http://cryptohampster.com/wp-content/uploads/2014/02/checkout.png)
 * [http://cryptohampster.com/wp-content/uploads/2014/02/paypal.png](http://cryptohampster.com/wp-content/uploads/2014/02/paypal.png)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611323)
 * The log, which is generated by the plugin, has the wrong amount, which is why
   PayPal pays the wrong amount.
 * The Order amount is $ 16.71 . . . NOT $16.70.
 * In fact, $order->get_total() returns 16.71, NOT 16.70.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611316)
 * One other thought:
 * I upgraded to the newest WC last night and the error still persists.
 * I looked at:
 * `$paypal_args['tax_cart'] = $order->get_total_tax();`
 * and changed it to:
 * `$paypal_args['tax_cart'] = round($order->get_total_tax(),2);`
 * and the error still persisted.
 * I then TURNED OFF (UNCHECKED) Apply Tax To Shipping and I was unable to duplicate
   the error. This does not mean that the error was not there, it just means that
   I did not hit the magic numbers that duplicate the error.
 * I also looked closely at the orders and was able to add the amounts in the order
   view and see how the truncating or rounding is causing the error.
 * Now you mentioned that total tax is always rounded to 2. Are you using the round
   function? Apparently the round function produces inconsistent results across 
   different platforms and this “feature” is well documented.
 * The workaround is to create your own function such as:
 *     ```
       <?php
       function mround($number, $precision=0) { 
   
           $precision = ($precision == 0 ? 1 : $precision);
           $pow = pow(10, $precision); 
   
           $ceil = ceil($number * $pow)/$pow;
           $floor = floor($number * $pow)/$pow; 
   
           $pow = pow(10, $precision+1); 
   
           $diffCeil     = $pow*($ceil-$number);
           $diffFloor     = $pow*($number-$floor)+($number < 0 ? -1 : 1); 
   
           if($diffCeil >= $diffFloor) return $floor;
           else return $ceil;
       }  
   
       echo mround(4.725, 2); // Yes 4.73
       ?>
       ```
   
 * Credits go to PHP.net for this code snipplet.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] PayPal Standard BROKEN when rounding amounts](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/paypal-standard-broken-when-rounding-amounts/#post-4611315)
 * You are referring to the PayPal transaction log, correct? Here it is:
 *     ```
       02-13-2014 @ 22:17:29 - Generating payment form for order #200. Notify URL: http://cryptohampster.com/?wc-api=WC_Gateway_Paypal
       02-13-2014 @ 22:17:48 - Checking IPN response is valid via https://www.sandbox.paypal.com/cgi-bin/webscr...
       02-13-2014 @ 22:17:48 - IPN Request: Array
       (
           [body] => Array
               (
                   [cmd] => _notify-validate
                   [mc_gross] => 16.70
                   [invoice] => CH-200
                   [protection_eligibility] => Eligible
                   [address_status] => confirmed
                   [item_number1] => SABERTOOTH 990FX R2.0
                   [tax] => 1.28
                   [item_number2] =>
                   [payer_id] => N95P4Y2UD8FE6
                   [address_street] => 3916 Walnut Ridge Ct
                   [payment_date] => 14:17:44 Feb 13, 2014 PST
                   [payment_status] => Completed
                   [charset] => windows-1252
                   [address_zip] => 63052
                   [mc_shipping] => 0.00
                   [mc_handling] => 0.00
                   [first_name] => Joe
                   [mc_fee] => 0.78
                   [address_country_code] => US
                   [address_name] => Brett Farnam
                   [notify_version] => 3.7
                   [custom] => a:2:{i:0;i:200;i:1;s:22:"wc_order_52fd44796402f";}
                   [payer_status] => unverified
                   [business] => jack-facilitator@cryptohampster.com
                   [address_country] => United States
                   [num_cart_items] => 2
                   [mc_handling1] => 0.00
                   [mc_handling2] => 0.00
                   [address_city] => Imperial
                   [verify_sign] => AFcWxV21C7fd0v3bYYYRCpSSRl31AwTtUiPWm.-6YWKcL-rCt5CdOqSZ
                   [payer_email] => brett.farnam+joe1@gmail.com
                   [mc_shipping1] => 0.00
                   [mc_shipping2] => 0.00
                   [tax1] => 0.00
                   [tax2] => 0.00
                   [txn_id] => 4WH19103T2424950M
                   [payment_type] => instant
                   [last_name] => Buyer
                   [address_state] => MO
                   [item_name1] => test item
                   [receiver_email] => jack-facilitator@cryptohampster.com
                   [item_name2] => Shipping via
                   [payment_fee] => 0.78
                   [quantity1] => 1
                   [quantity2] => 1
                   [receiver_id] => DXNT9EY8UJX6W
                   [txn_type] => cart
                   [mc_gross_1] => 1.00
                   [mc_currency] => USD
                   [mc_gross_2] => 14.42
                   [residence_country] => US
                   [test_ipn] => 1
                   [transaction_subject] => a:2:{i:0;i:200;i:1;s:22:"wc_order_52fd44796402f";}
                   [payment_gross] => 16.70
                   [ipn_track_id] => b64728a9d7aa0
               )
   
           [sslverify] =>
           [timeout] => 60
           [httpversion] => 1.1
           [compress] =>
           [decompress] =>
           [user-agent] => WooCommerce/2.1.1
       )
   
       02-13-2014 @ 22:17:50 - IPN Response: Array
       (
           [headers] => Array
               (
                   [date] => Thu, 13 Feb 2014 22:17:49 GMT
                   [server] => Apache
                   [x-frame-options] => SAMEORIGIN
                   [set-cookie] => Array
                       (
                           [0] => c9MWDuvPtT9GIMyPc3jwol1VSlO=mjW0xhxoByVi0yOEj1zwJnOZ-zQ1xV8wJHATaoOfltN2GEJAhH28pljb6-_TtpEiIfalhwm20gYGtCsoGe9W3v7CgHJkyzj2gn2db_mEeZx5bhobrL6Y5FWKnOxocI09ifHd_uM66F5b9OSKBsfvds3Tw3CYyPF8zBjjPFxYELYN-e5CpC_bb2z6TPtjc288yciBC56-7eXHdeN5HVpOuOHr7-ziE-zdv09CyBZizGTq78nudviQamykE7umV-v6zN-xvCqanzZZDD79Sihq1WhsVRkVC4yinv0DL2gf6kR_Onr_M7ii_x7KZWbYPITaaROO9EYOZ0k56Q6WblaloGkrK7JbBM9q6qBsGzdPjdV2om5ot8I0Q2QWYpxw5_A35-QxDYgWtv3YGD3mSeVf2U1u1uszVspMT_f_sIVNlXS4bVukH4xZU3xMmy0; domain=.paypal.com; path=/; Secure; HttpOnly
                           [1] => cookie_check=yes; expires=Sun, 11-Feb-2024 22:17:50 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
                           [2] => navcmd=_notify-validate; domain=.paypal.com; path=/; Secure; HttpOnly
                           [3] => navlns=0.0; expires=Sat, 13-Feb-2016 22:17:50 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
                           [4] => Apache=10.72.109.11.1392329869675692; path=/; expires=Sat, 06-Feb-44 22:17:49 GMT
                           [5] => X-PP-SILOVER=name%3DSANDBOX3.WEB.1%26silo_version%3D880%26app%3Dslingshot%26TIME%3D2370108754; domain=.paypal.com; path=/; Secure; HttpOnly
                           [6] => X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
                           [7] => Apache=10.72.128.11.1392329869660170; path=/; expires=Sat, 06-Feb-44 22:17:49 GMT
                       )
   
                   [connection] => close
                   [vary] => Accept-Encoding
                   [strict-transport-security] => max-age=14400
                   [transfer-encoding] => chunked
                   [content-type] => text/html; charset=UTF-8
               )
   
           [body] => VERIFIED
           [response] => Array
               (
                   [code] => 200
                   [message] => OK
               )
   
           [cookies] => Array
               (
                   [0] => WP_Http_Cookie Object
                       (
                           [name] => c9MWDuvPtT9GIMyPc3jwol1VSlO
                           [value] => mjW0xhxoByVi0yOEj1zwJnOZ-zQ1xV8wJHATaoOfltN2GEJAhH28pljb6-_TtpEiIfalhwm20gYGtCsoGe9W3v7CgHJkyzj2gn2db_mEeZx5bhobrL6Y5FWKnOxocI09ifHd_uM66F5b9OSKBsfvds3Tw3CYyPF8zBjjPFxYELYN-e5CpC_bb2z6TPtjc288yciBC56-7eXHdeN5HVpOuOHr7-ziE-zdv09CyBZizGTq78nudviQamykE7umV-v6zN-xvCqanzZZDD79Sihq1WhsVRkVC4yinv0DL2gf6kR_Onr_M7ii_x7KZWbYPITaaROO9EYOZ0k56Q6WblaloGkrK7JbBM9q6qBsGzdPjdV2om5ot8I0Q2QWYpxw5_A35-QxDYgWtv3YGD3mSeVf2U1u1uszVspMT_f_sIVNlXS4bVukH4xZU3xMmy0
                           [expires] =>
                           [path] => /
                           [domain] => .paypal.com
                           [secure] =>
                           [httponly] =>
                       )
   
                   [1] => WP_Http_Cookie Object
                       (
                           [name] => cookie_check
                           [value] => yes
                           [expires] => 1707689870
                           [path] => /
                           [domain] => .paypal.com
                           [secure] =>
                           [httponly] =>
                       )
   
                   [2] => WP_Http_Cookie Object
                       (
                           [name] => navcmd
                           [value] => _notify-validate
                           [expires] =>
                           [path] => /
                           [domain] => .paypal.com
                           [secure] =>
                           [httponly] =>
                       )
   
                   [3] => WP_Http_Cookie Object
                       (
                           [name] => navlns
                           [value] => 0.0
                           [expires] => 1455401870
                           [path] => /
                           [domain] => .paypal.com
                           [secure] =>
                           [httponly] =>
                       )
   
                   [4] => WP_Http_Cookie Object
                       (
                           [name] => Apache
                           [value] => 10.72.109.11.1392329869675692
                           [expires] =>
                           [path] => /
                           [domain] => www.sandbox.paypal.com
                       )
   
                   [5] => WP_Http_Cookie Object
                       (
                           [name] => X-PP-SILOVER
                           [value] => name=SANDBOX3.WEB.1&silo_version=880&app=slingshot&TIME=2370108754
                           [expires] =>
                           [path] => /
                           [domain] => .paypal.com
                           [secure] =>
                           [httponly] =>
                       )
   
                   [6] => WP_Http_Cookie Object
                       (
                           [name] => X-PP-SILOVER
                           [value] =>
                           [expires] => 1
                           [path] => /cgi-bin/
                           [domain] => www.sandbox.paypal.com
                       )
   
                   [7] => WP_Http_Cookie Object
                       (
                           [name] => Apache
                           [value] => 10.72.128.11.1392329869660170
                           [expires] =>
                           [path] => /
                           [domain] => www.sandbox.paypal.com
                       )
   
               )
   
           [filename] =>
       )
   
       02-13-2014 @ 22:17:50 - Received valid response from PayPal
       02-13-2014 @ 22:17:50 - Found order #200
       02-13-2014 @ 22:17:50 - Payment status: completed
       02-13-2014 @ 22:17:50 - Payment error: Amounts do not match (requested 16.71 and received 16.70)
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Maximum Quantity for WooCommerce Shops] Problem with WP 3.8.1 & WC 2.1.1](https://wordpress.org/support/topic/problem-with-wp-381-wc-211/)
 *  Thread Starter [bfarnam](https://wordpress.org/support/users/bfarnam/)
 * (@bfarnam)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-wp-381-wc-211/#post-4609710)
 * Thank You! I just tested in WP 3.8.1 and WC 2.1.2 and it is fixed!
 * Brett

Viewing 12 replies - 1 through 12 (of 12 total)