• Resolved jonrhine

    (@rhinedesign)


    Woocommerce order prices aren’t matching what square charges with a discount applied. A customer just emailed me they got overcharged.

    I’m using another plugin, Woo Discount Rules – I use this plugin with other processors and don’t have this issue so I don’t believe it is the plugins fault, but Square is not reflecting the discount prices.

    For example, today everything is 20% off, and woocommerce records the discounted amount and sends the email correctly out to the consumer, but square is charging the original amount.

    Woocommerce 3.6.5 and Woocommerce Square 2.0.0
    I’ll open up a thread also with woo discount rules, see if they have thoughts also

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @rhinedesign,

    Woocommerce order prices aren’t matching what square charges with a discount applied. A customer just emailed me they got overcharged.

    This is one of the issues that caused our developers to pull back the 2.0.0 and 2.0.1 Square plugin releases to work on them. The stable version is currently 1.0.38.

    We are going to release 2.0.2 hopefully within the next week (do not quote me on it, but we are in final testing) so you can wait for that release, or you can downgrade back to the stable version. If you choose to downgrade to the stable version you can do these steps:

    – Disconnect from Square at **WooCommerce > Settings > Square**
    – Disable, then delete the plugin
    – Install 1.0.38 (from the front page).
    – Re-connect and then re-sync with Square. Make sure your **Business Location** shows.
    – After this you can run a test purchase to make sure it is working correctly.

    If you have further questions let me know!

    I was having a similar issue. I downgraded to 1.0.38 as per Mike W’s instructions, and all appears to be working again!

    Thank you for this quick fix. ??

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    Please note: this is still an ongoing issue and has not been resolved as of the current version.

    The short explanation is that the line item’s Square Catalog ID passed to Square results in the Square API looking up the full price of the Square product and ignoring discounts/sale prices.

    This appears to be a limitation with the Square v2 API so we’re researching ways to resolve this.

    @shellbeezy

    This issue is not only related to discounts. We don’t use any discounts but got this issue. The reason is the weak ability of PHP in storing float values. Here is a real-life example:
    I got this error when tried to buy products at 69.60$. I investigated logs and found that your plugin sends the wrong final amount – 6959 cents. Your plugin has a function for converting dollars to cents(Money_Utility::amount_to_cents). And there we have an error. (int) conversion sometimes(depends on the price) cuts off part of the price. You can debug this with the next line: sprintf(‘%.40F’, ( ( 10 ** 2 * 69.60 ) ) – there will be a float number with huge about of digits after the comma. And (int) conversion cuts them off, so the result is 6959.

    The workaround for this issue is to add “round” function before converting to int so this function should look like this:

    wp-content/plugins/woocommerce-square/includes/Utilities/Money_Utility.php

    	public static function amount_to_cents( $amount, $currency = '' ) {
    
    		if ( ! $currency ) {
    			$currency = get_woocommerce_currency();
    		}
    
    		return (int) ( round( ( 10 ** self::get_currency_decimals( $currency ) ) * $amount ) );
    	}
    
    Thread Starter jonrhine

    (@rhinedesign)

    @kirillgritcenko thinking that’s an unrelated, separate issue.

    @shellbeezy confirming that coupon codes still apply their discounts correctly and pass that discounted total to square – just an idea, maybe it’d be possible to calculate the difference between square’s line item cost vs woocommerce’s correct total and pass a fixed amount discount similar to coupons?

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    @kirillgritcenko,

    Thanks for the information you’ve provided here; I’ve tested that hotfix and it is working for me. We’ll test it some more and make sure it’s working properly so it can be fixed in 2.0.4.

    @rhinedesign, it is somewhat related as it is ultimately caused by the price in WooCommerce not matching the price in Square. We are working on fixing this in 2.0.4 to accommodate not only discounts but rounding errors as well.

    Cheers!

    @kirillgritcenko THANK YOU!!

    Thread Starter jonrhine

    (@rhinedesign)

    @shellbeezy thanks to your team for getting the discount difference adjustment in

    Interestingly @shellbeezy We were having issues where Square as the Source of Record was randomly not syncing inventory from Square Since the Update. We just went back to 1.038 on a hunch and per your instructions above and everything is syncing again perfectly. We could never identify why one product would sync vs another but the 1.038 syncs perfectly.

    We did try removing SKUs changing stock levels etc but could not find anything to say one way or the other. Whatever I can do to assist or information I can get you let me know.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Woocommerce Square 2 discount not matching’ is closed to new replies.