How to change the format of zip code to fit a zapier integration

Hi, we are trying the integration of foxy and zapier to be able to send (Boleto bancário) to our costumers using boletosimples.

In Brazil zip code (CEP) is written in this format: XXXXX-XXX

So to be able to create boletos i would need to force costumers to fullfill this field using that format.

We have made a similar change for Brazilian tax id, how can we do it to zip code?

Thank you.

Comments
  • Hi Marija,

    Answer to your questions:

    1- Right now i do not ship any product, and yes costumers will only use billing address.
    2- Yes, this is only for Brazil as Boleto Bancário is something that exists only in Brazil.

    Thank you!
  • fc_adamfc_adam FoxyCart Team
    @leaodonorte,

    Just to confirm - our checkout will already validate the format of a Brazilian postcode, but it currently accepts two formats, 12345-678 and 12345678. Will both of those formats be acceptable for the integration you're using on Zapier? Or will it specifically need that dash included in there?
  • Hi Adam,

    Only this format 12345-678 works for the integration, because this is the "official format by mail service, and the only one accepted by the banks".

    Thanks!
  • fc_adamfc_adam FoxyCart Team
    @leaodonorte,

    Thanks for confirming. To ensure that the only valid format is one where the dash is included, you could include some javascript on your store to update the format the checkout looks for. You can do that with code like this added to your store's "footer" in the "Add custom header and footer code to your templates" configuration option:
    {% if context == "cart" or context == "checkout" %}
    <script>
    function updateBrazil() {
    FC.json.config.locations.BR.pc.regex = /\d{5}\-\d{3}/;
    }

    $(updateBrazil);
    FC.client.on("ready.done", updateBrazil);
    </script>
    {% endif %}
Sign In or Register to comment.