The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Paypal button in sidecart: graceful handling?

We had a customer report to us that they couldn't check out because the paypal button in the cart was broken-- it just didn't do anything. We tried to reproduce it with their conditions, and it sure felt broken to us-- the button just *does nothing.*

The root cause, "of course" is that it will always do this if you haven't selected a shipping method. (Or, if you haven't entered your zip code for tax.)

I presume that this is the normal and expected behavior for the cart. However, it is not very graceful. Is there any way to show the user a message, indicating that they need to fill out the form before the button will work?
Comments
  • fc_adamfc_adam FoxyCart Team
    edited May 2015
    @oskay,

    You are correct - and it's definitely not a great experience for the customer. The postal code field does receive focus, but it's not really apparent at all that that is what has happened. Our logic should be displaying an error for those fields as well, so the customer would see visually that they're required, but obviously that isn't happening. I'll create a ticket to get that fixed.

    In the meantime, you can add something like this to your website to provide some visual feedback to the customer:
    $(document).ready(function() {
    $('[data-fc-container="cart"]').on('click', '[data-fc-id="paypal-link"]', function (event) {
    if (FC.json.shipping_address.has_live_rate_shippable_products &&
    (typeof(FC.json.shipping_address.shipping_service_id) === "undefined"
    || FC.json.shipping_address.shipping_service_id === "0"
    || FC.json.shipping_address.shipping_service_id == 0)) {
    FC.util.addError("shipping-results", "Please select a shipping rate");
    }
    if ((FC.json.has_location_dependent_taxes && !FC.json.taxes_calculated) || !FC.util.addressHasLocationInfo()) {
    FC.util.addError("shipping_postal_code");
    }
    FC.cart.render();
    event.preventDefault();
    });
    });
  • oskayoskay Member
    Thanks for opening a ticket on this, and for the suggested workaround. That does seem to work in the full page cart, but still leaves the button "broken" in the sidecart.
  • fc_adamfc_adam FoxyCart Team
    @oskay,

    Looking at your store - you've added the script to the full page cart template. That won't impact the sidecart at all. I'd recommend adding it to the "footer" custom code configuration option for your store, and removing it from the cart template. That way it will be included on both the Sidecart and Full page cart templates.
  • oskayoskay Member
    Of course; that makes perfect sense. Thanks!
Sign In or Register to comment.