I want to show/hide a few shipping methods based on the ZIP code entered at the checkout. I am trying to write a shipping script for that but facing an issue that I can't check if a Zipcode starts with some value or not. So, for example, if a customer enters the ZIP code "BT1 1BG" I want to check if it starts with "BT" or not.
According to my knowledge, I can only check the exact match or partial match but in case of the partial match it would return true if "BT" exists anywhere in the ZIP code, for example, "EC1A 1BT"; and I don't want this result. I tried to use "start_with" method, but it is not working in the Shipping script.
Any solution or workaround would be much appreciated!
- Was my reply helpful? Click Like and Accept as Solution - Want to implement a custom solution? Feel free to contact me at email@example.com