Solved

Shipping Address Zip Returning FalseClasss

BradKrane
Shopify Partner
44 4 10

Hi,

 

I'm trying to test for the second character in a postal code being a '0' as this signifies that the destination is a rural address and due to some carriers charging exorbitant delivery fees for rural delivery we would like to remove those carriers as options for delivery.

 

The issue is that while the API doc says that the shipping_address.zip property is a string it is actually returning FalseClass.

 

Annotation 2020-03-09 134541.png

 

There is no RegExp test available either which is disappointing.

 

How can one test if the 2nd non-white space character is a '0' ?

 

Thanks!

Accepted Solution (1)

BradKrane
Shopify Partner
44 4 10

This is an accepted solution.

The solution to get a String back is:

 

str = String(Input.cart.shipping_address.zip)

View solution in original post

Reply 1 (1)

BradKrane
Shopify Partner
44 4 10

This is an accepted solution.

The solution to get a String back is:

 

str = String(Input.cart.shipping_address.zip)