Ever had to deal with postcodes in Magento 2 store for managing the shipping charges?
Is your business charging shipping rates in Magento 2 store based on the location of delivery?
If yes, you might have to juggle between the postcodes assigned to the shipping rules and the values entered by the frontend user in your store. Magento assigns the shipping charges by matching the postcode and the shipping rule configured.
However, if there is a variation in postcodes, for example, uppercase and lowercase, there are chances of errors in the calculation.
The solution to avoid it is to use SQL query for case sensitive data in Magento 2. Use the below method to differentiate the postcode with uppercase or lowercase and accordingly charge the shipping rates!
You can use this method where you want to differentiate values based on the case sensitivity.
Method to Use SQL Query for Case Sensitive Data in Magento 2:
Dataset:
Table Name: Custom
No. | PostCode |
---|---|
1 | GL1 |
2 | Gl1 |
syntax = SELECT * FROM `table` WHERE BINARY `column` = 'value'
example = SELECT * FROM Custom WHERE BINARY Postcode = GL1
When you run the above query, you’ll get the below output:
No Postcode
1 GL1
That’s it.
Also, do share the post with the Magento Community via social media.
Thank you.