Code snippet to ignore the digits after ‘-‘ in postcodes provided for ‘Ship to’ address in Stamps plugin

The code snippet facilitates to ignore the numbers after ‘-‘ in postcodes provided for ‘Ship to’ address.

Add the following code to your Appearance –> Editor –> functions.php.

Suppose customer provides the following postcode to place an order ‘90746-4028’. The above code snippet will ignore the postcodes after ‘-‘, so 4028 will be ignored and only ‘90746’ will be considered. Using the first 5 digits for postcode works perfectly with Stamps API.

Leave a Reply