• Resolved kubadrex

    (@kubadrex)


    I got a strange problem with a total price that Google Pay is showing to the user. I’m using the plugin in the test mode.

    We are using the Avalara AvaTax plugin for tax calculation.

    1. I’m adding the taxable product to the cart
    2. Proceeding to checkout, where the Google Pay button is displayed for the user
    3. Woo checkout is showing $227.16 of total amount ($199 for product, $18.16 of tax, $10 for shipping)
    4. Clicking the Google Pay button
    5. For a second or two, I can see the correct price but then the price is reduced by the tax amount (it’s showing $209).
    6. When I complete the order by using the “Pay” button within the dialog box, order is completed and I can see the full price again
    7. So what user sees is not what he is paying for some reason
    8. The problem is inconsistent, sometimes I’m seeing the correct price until the end of the payment process

    Now lets look at the requests body

    wc-ajax: wc_stripe_get_shipping_options
    
    security: 484cc05c6e
    country: US
    state: CA
    postcode: 94043
    city: Mountain View
    address: 
    address_2: 
    payment_request_type: google_pay
    is_product_page: 

    As you can see, for some reason the “address” field is empty. I’m using the Google test account (https://developers.google.com/pay/api/android/guides/resources/test-card-suite) and I can see that the street is there:

    The response body is as follows:

    {
        "shipping_options": [
            {
                "id": "flat_rate:2",
                "label": "Standard shipping",
                "detail": "",
                "amount": 1000
            }
        ],
        "displayItems": [
            {
                "label": "Subtotal",
                "amount": 19900
            },
            {
                "label": "Tax",
                "amount": 0
            },
            {
                "label": "Shipping",
                "amount": 1000
            }
        ],
        "total": {
            "label": " (via WooCommerce)",
            "amount": 20900,
            "pending": false
        },
        "result": "success"
    }

    The tax here is 0, so probably thats why it is not included in the total price, but the question is why.

    Apart from that, I got a questions what is happening in the background of this plugin. All the price-related stuff is taken from Woo (products subtotal, tax, shipping) this information is sent to Google Pay and based on that we price is displayed?

    I also see something strange – I have multiple Google Accounts within my Chrome browser. I’m seeing the correct shipping price for the first account:

    Then I changed the account and this happened:

    For some reason shipping option is “pending”, where both of those examples are from the same state, so there is no option that some settings are wrong (for example, because we ship to specific states, by Woo settings). The request is as follows after changing the account:

    wc-ajax: wc_stripe_get_shipping_options
    
    security: 484cc05c6e
    country: US
    state: CA
    postcode: 90404
    city: Santa Monica
    address: 
    address_2: 
    payment_request_type: google_pay
    is_product_page: 

    Again, address field is empty.

    I’m able to share the URL with a support member, but I’m not allowed to share it here publicly.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello kubadrex,

    Thank you for contacting WooCommerce support.

    I understand you are facing an issue with Google Pay where it sometimes shows the total price without the tax.

    This is indeed strange behavior. Let’s try to further diagnose the problem.
    To start, it would be very helpful if you could provide the following:

    1. System Status: Navigate to WooCommerce > Status on your admin dashboard. There, select “Get system report” and then “Copy for support”. You can paste the report in your response here.
    2. Error Log: Share a copy of the fatal error log. You can find this under WooCommerce > System Status > Logs.

    With this information, we will be better able to investigate and understand what might be causing this issue on your site.

    Looking forward to your response.??

    Thread Starter kubadrex

    (@kubadrex)

    Hello Zubair, thanks for your reply.

    1. System status – https://pastebin.com/0vyaeUy0
    2. Error log

    Hey, @kubadrex!

    Thanks for sharing the information.

    I see that your WordPress version, as well as the WooCommerce plugin and the Stripe plugin are all out of date.

    Please update them all and check if the issue persists.

    If it does, can you send us the new error logs so we can make sure any errors caused by the old versions are gone?

    Thank you.

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter kubadrex

    (@kubadrex)

    I have updated WordPress, Woo and Stripe plugin now. Tested but I can see the same issues occurs – sometimes it is working correctly and sometimes it does not.

    I also noticed another strange behavior, where the shipping cost is visible in the Google Pay dialog box, but it is not included in the total price:

    I’m attaching the logs:

    1. System status – https://pastebin.com/gH1KTAGa
    2. Error log – https://pastebin.com/JJfnK2nE
    Saif

    (@babylon1999)

    Hello @kubadrex,

    Could you confirm if this issue occurs when using express checkout options on the cart or checkout pages?

    This could be related to one of the known incompatibilities when placing orders directly from the product page. More can be found at: https://woo.com/document/stripe/#what-type-of-products-can-be-purchased-with-the-payment-request-button

    There’s also a long discussion on GitHub which specifically references the Avalara extensions here: https://github.com/woocommerce/woocommerce-gateway-stripe/issues/566

    I also noticed another strange behavior, where the shipping cost is visible in the Google Pay dialog box, but it is not included in the total price:

    Can you share some screenshots of your shipping settings in WooCommerce → Settings → Shipping?

    Look forward to hearing back from you.

    Thread Starter kubadrex

    (@kubadrex)

    Could you confirm if this issue occurs when using express checkout options on the cart or checkout pages?

    We are using it only on the checkout page. I have checked it on the Cart page but the result is the same.

    Can you share some screenshots of your shipping settings in WooCommerce → Settings → Shipping?

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hello again @kubadrex,

    Thank you for sharing the screenshot. I was able to check your shipping settings, and they seem to be correct.

    To troubleshoot the issue further, could you please deactivate all other plugins and try adding tax through WooCommerce and make a test purchase to see if the correct prices will be displayed inclusive of tax?

    Let us know how it goes.

    Thread Starter kubadrex

    (@kubadrex)

    Hello,

    I have disabled Avalara and looks like this is solving the issue as now I’m able to freely change the shipping address and the tax is always calculated. I have experienced once a problem with the shipping option though, but when I have changed the address it populated correctly.

    Besides of this shipping issue that sometimes occur, I’m wondering if it is possible to use some hook/filter to do some custom logic before passing the tax amount from Woo to the Stripe plugin/Google Pay? In worst case, we can consider changing the tax plugin, but we would like to stay with Avalara if possible. If there is a possibility to apply some custom logic, maybe I will be able to fix this issue with some extra code.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @kubadrex,

    I have disabled Avalara and looks like this is solving the issue as now I’m able to freely change the shipping address and the tax is always calculated. I have experienced once a problem with the shipping option though, but when I have changed the address it populated correctly.

    I’m glad to hear that disabling Avalara seems to have resolved the issue.

    I’m wondering if it is possible to use some hook/filter to do some custom logic before passing the tax amount from Woo to the Stripe plugin/Google Pay? In worst case, we can consider changing the tax plugin, but we would like to stay with Avalara if possible. If there is a possibility to apply some custom logic, maybe I will be able to fix this issue with some extra code.

    Yes, it is possible. WooCommerce provides several hooks and filters that you can use to customize the tax calculation process. However, please note that this requires a good understanding of PHP and WordPress hooks/filters.

    To do so, you can use the woocommerce_calculated_total filter to modify the tax: https://wp-kama.com/plugin/woocommerce/hook/woocommerce_calculated_total

    Though writing or providing custom code is not within the scope of our support policy, however here is a basic example of using a filter to modify the tax:

    add_filter( 'woocommerce_calculated_total', 'custom_calculated_total', 10, 2 );
    function custom_calculated_total( $total, $cart ) {
    // custom logic
    return $total;
    }

    Therefore, if you need help, we recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question.

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Thread Starter kubadrex

    (@kubadrex)

    Yes, it is possible. WooCommerce provides several hooks and filters that you can use to customize the tax calculation process. However, please note that this requires a good understanding of PHP and WordPress hooks/filters.

    This is not a problem, I’m developer with WordPress experience, so feel free to share with me some technical details as well.

    Are you aware that the hook/filter that you have mentioned will allow me to get the shipping address that the user put within the GooglePay dialog box? This dialog box is not a part of the website checkout form, so I’m not sure if such data is accessible using any hook/filter.

    Is there another tax plugin that is confirmed to be working with your plugin? Or anything that you can recommend as an alternative?

    Thanks

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @kubadrex,

    Yes, you are correct; I missed this somehow. However, to access the shipping address from the Google Pay dialog box, you might need to use JavaScript to interact with the Google Pay API directly, as the address entered there is not typically passed back to WooCommerce until the transaction is complete.

    Unfortunately, this is beyond the scope of WooCommerce Stripe Payment Gateway’s built-in functionality and would require custom coding. We recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your query.

    Is there another tax plugin that is confirmed to be working with your plugin? Or anything that you can recommend as an alternative?

    As for alternative tax plugins, there are several that are compatible with WooCommerce, such as the WooCommerce Tax.

    However, it’s always a good idea to test this plugin in a staging environment before implementing it on your live site.

    I hope this helps! If you have any other questions, feel free to ask.

    Thread Starter kubadrex

    (@kubadrex)

    Hello, I’d like to come back to this topic. I have made further testing and I can see an issue with the shipping options within the Google Pay dialog. My website got two flat rate options for US, we do not ship to other countries.

    On the initial load, everything seems fine, but the problem starts when I start changing options, account specifically. My test has been made on the Twenty Twenty-Two theme on default Woo templates, to minimize the influence of the custom solutions.

    First, after the initial load I press the “Buy with GPay” button on my checkout page (I’m using it only on that page), shipping cost is correctly displayed: https://ibb.co/WyP7Mbp

    Then I’m changing the account in the first select to use another one and the shipping option is “pending” https://ibb.co/kqs0FFF. Even when I change the shipping address to a different one (to kinda “retrigger” calculation), the problem persists https://ibb.co/jT339fr. What’s interesting, the price displayed contains the shipping cost for all that time.

    Checking the request that is being sent, looks like the response contains the correct data – https://ibb.co/5cr2KgK, so it’s even more interesting.

    The issue is really inconsistent – sometimes I’m not able to make it work but another time it seems to be displaying the shipping price correctly.

    Hi there @kubadrex ??

    Thank you for reaching back, with further details on this.

    From what I gather, the reported issue, with the wrong total price in the Google Pay pop-up window, inconsistently appears on the site, when a shipping option, an address, or the selected Google Account change. Am I getting this?

    My test has been made on the Twenty Twenty-Two theme on default Woo templates, to minimize the influence of the custom solutions.

    To get an idea of how the site is configured at this point in time, could you please share a copy of your site’s System Status, as exemplified here? Once you’ve done that, paste it here in your response.

    Additionally, fresh screenshots of the tax, and shipping, settings would be necessary.

    The goal of requesting the info is for us to clarify how things stand, and try reproducing the issue on our end.

    Looking forward to hearing from you!

    • This reply was modified 1 year, 1 month ago by anastas10s. Reason: typo
    Thread Starter kubadrex

    (@kubadrex)

    From what I gather, the reported issue, with the wrong total price in the Google Pay pop-up window, inconsistently appears on the site, when a shipping option, an address, or the selected Google Account change. Am I getting this?

    The issue is that sometimes on the account change, the shipping option is shown as “Pending”, even though it looks like the request got the correct available options, but the shipping stays as “Pending” within the dialog box.

    System status – https://pastebin.com/mGmbthYw
    There are some plugins that needs update, but as it can be seen in this thread, we also experienced this problem when everything was up to date.

    Additionally, fresh screenshots of the tax, and shipping, settings would be necessary.

    Lately I have installed the https://woo.com/products/tax/ as sugessted, as we experienced problems with tax & Google Pay as well, but I want to solve the shipping issue first.

    https://ibb.co/jZX33wP
    https://ibb.co/sH7JnNJ
    https://ibb.co/Ykg2Byh

    Thank you for reaching back, clarifying things further, @kubadrex.

    The issue is that sometimes on the account change, the shipping option is shown as “Pending”, even though it looks like the request got the correct available options, but the shipping stays as “Pending” within the dialog box.

    Let’s start with isolating it further. In order to do so, a staging/test environment needs to be created (if not yet done so), with a default theme active (like TT3), and only the WooCommerce and WooCommerce Stripe Payment Gateway active (and updated to their latest versions).

    First it needs to be tested that with the above set up, there is no issue receiving payment for an order via Google Pay (with the shipping settings as showcased in the screenshots). Then, the next step would be to test with changing Google accounts in the Google Pay pop-up window.

    Further details on performing a conflict test, are detailed here.

    Tools to help with troubleshooting

    Meks Quick Plugin Disabler will remember what plugins you had active when you switch it back on.

    You can clone your site to a staging environment and perform tests without modifying your live site or impaclting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.

    Please let us know how that goes.

    I trust that points you in the right direction, but if you have more questions, let us know. We’re happy to help.

    • This reply was modified 1 year, 1 month ago by anastas10s. Reason: typos
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘GooglePay dialog box showing wrong total price’ is closed to new replies.