Skip to content

Instantly share code, notes, and snippets.

@kirelagin
Last active September 4, 2025 16:59
Show Gist options
  • Save kirelagin/e4f68f9e802ae34e3008c24a2628c494 to your computer and use it in GitHub Desktop.
Save kirelagin/e4f68f9e802ae34e3008c24a2628c494 to your computer and use it in GitHub Desktop.
How to add a Swiss address on AliExpress

Swiss address on AliExpress

How to enter a Swiss address on AliExpress.

The problem

AliExpress has a stupid interface for entering your address – it makes you select the country, then the canton/region/state, then the city, all from drop-down lists. Of course, their drop-down lists are incomplete: e.g., for most cantons in Switzerland, they only have the capital city and nothing else.

If you contact their support, they will tell you to select the “other” option. But this option is only available on the web, not in their app, and even there it does not work due to what seems to be an obvious bug in their code.

Here is how to work it around. You will need a desktop computer for this, I do not know of an easy way to do the same from your phone.

The instructions that follow are for Firefox as it is what I use, but it should be pretty much exactly the same on Chrome (one difference is that the “Debugger” tab is called “Sources” there). If you try to do this in Chrome, let me know how it goes and what differences you encounter, so that I can update the instructions accordingly.

Step 1: Add your address as “Other country”

Go to your settings, start adding a new address. In the “country” field, select “Other Country”:

Select “Other country”

Then just fill in your details:

Enter your address

Step 2: Find the code that sends the request

I feel like there should be an easier way to do this, but I could not figure it out. Please comment below if you have any ideas.

Open Developer Tools: go to Browser menu → More tools → Web Developer Tools (or press Ctrl+Shift+I / ⌘+⌥+I on macOS).

Click the “Debugger” tab:

Debugger tab in Developer Tools

On the right, expand “XHR Breakpoints” and set the checkbox next to “Pause on any URL”:

Pause on any URL

Press the red “Confirm” button on the page to submit your new address. The AliExpress page will freeze, this is normal, just keep working with the Developer Tools.

Press the { } button at the bottom left of the code area (right below the line numbers):

Code line

Now uncheck “Pause on any URL” in the right panel.

Notice the highlighted line in the code area. Right-click its line number, select “Add breakpoint”. Right-click the same line number again, select “Add condition”, and type Sr.name == "send" in the input field that appears:

Conditional breakpoint

Press enter; the marker on the line number should turn from blue to amber.

Step 3: Intercept the request

We are now ready to hack the request!

Press the “play” button on the panel overlayed over the frozen page:

Resume the page

This will unfreeze the page.

Now click “Confirm“ for the second time, the page will freeze again, but this time we get a chance to edit the request before it is sent to the server.

Note what it says after this, in the highlighted line of code. In my screenshots, it is a, but they might change it in the future. If you see something different from a, then substitute what you see in the next steps.

Under “Breakpoints” on the right panel, remove the breakpoint with Sr.name == "send" and the number of our line of code:

Remove the breakpoint

Go to the “Console” tab of the Developer Tools. (There will be a bunch of amber warnings and red errors there, just ignore them, this is how people write code nowadays, not much we can do about it.)

In the input field at the bottom of the console, type: a[0] = a[0].replace("OTHER", "CH"):

Edit the request

Press “Enter”. Ok, done, you have just set the correct country (CH for Switzerland) in your brand-new address.

Now press the “play” button on the page once again.

You should see a bunch of stuff happening and, eventually, you will get redirected back to the page with your addresses, where you will find your new address added. You can close Developer Tools at this point.

In my experiments, I would always end up with “undefined” in the “apartment” field. You can now just click “Edit” and edit your address normally to revert the “apartment” field to empty. Just be careful not to touch the “city” field :).

@kirelagin
Copy link
Author

Hey everyone, thanks for sharing your experiences. It looks like they have indeed added replay protection :(. (Imagine if they spent their resources to fix the original issue instead!)

I have updated the instructions with a new method (based on modifying the XHR request in JavaScript right before it is sent). Hopefully, this will be more reliable and will last longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment