The Entrepreneur Forum | Financial Freedom | Starting a Business | Motivation | Money | Success
  • SPONSORED: GiganticWebsites.com: We Build Sites with THOUSANDS of Unique and Genuinely Useful Articles

    30% to 50% Fastlane-exclusive discounts on WordPress-powered websites with everything included: WordPress setup, design, keyword research, article creation and article publishing. Click HERE to claim.

Welcome to the only entrepreneur forum dedicated to building life-changing wealth.

Build a Fastlane business. Earn real financial freedom. Join free.

Join over 90,000 entrepreneurs who have rejected the paradigm of mediocrity and said "NO!" to underpaid jobs, ascetic frugality, and suffocating savings rituals— learn how to build a Fastlane business that pays both freedom and lifestyle affluence.

Free registration at the forum removes this block.

Would someone be able to help me figure this out?

Marketing, social media, advertising

B_Mac

Redneck Oligarch
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
480%
Apr 10, 2017
119
571
Southwest Virginia
I am selling a product through Shopify. I want to put a semi-personalized thank you note in the box. What I have is 8 different notecards, each printed with something different. Which card the person gets is determined by their proximity to the thing printed on the card. So here's the question. What can I do to easily determine the distance between a customers ZIP code and the 8 ZIP codes of the thing printed on the card.

I guess one option is to just look it up manually via google maps, but thats so time consuming. I've considered an excel macro, but my experiences with those have been poor. I had a few friends recommend javascript, but I dont know how to integrate that into the shopify backend or if its even possible. Ive googled zip code distance calculators, and they exist, but its only between two zip codes.

Any thoughts?
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

Ocean Man

Life-long learner.
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
222%
Sep 26, 2018
902
1,999
United States
@B_Mac I have experience with making private custom applications for Shopify. Specifically with automation.

I would need more information as I don’t think I fully understand your question. But you could have the application look at every new order that comes in, looks at the zip code, compares it to the list of notecard zip codes, and then does something. I think you’d need to utilize some other library or API to find the distance between zip codes.
 

The-J

Dog Dad
FASTLANE INSIDER
EPIC CONTRIBUTOR
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
264%
Aug 28, 2011
4,220
11,135
Ontario
Why does it have to be by distance? Why not just separate the USA into 8 different "zones" and choose a landmark for each zone? Then cross reference the customer's ZIP code to a database of ZIP codes that correspond to a specific zone (you could do this manually if you really wanted to but you don't have to)
 

Ocean Man

Life-long learner.
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
222%
Sep 26, 2018
902
1,999
United States
@B_Mac Check out this free API: Zip Code API Documentation
You can determine the distance between to Zip Codes and the result will be returned in JSON format that tells the distance in either km or miles.

Maybe you can run customer's zip code through the API comparing it to a list of Zip Codes that are from your card. And you specify like "If the distance between the customer's zip code and this zip code is less 10 miles then use card y"... etc.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

B_Mac

Redneck Oligarch
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
480%
Apr 10, 2017
119
571
Southwest Virginia
@B_Mac I have experience with making private custom applications for Shopify. Specifically with automation.

I would need more information as I don’t think I fully understand your question. But you could have the application look at every new order that comes in, looks at the zip code, compares it to the list of notecard zip codes, and then does something. I think you’d need to utilize some other library or API to find the distance between zip codes.
You’ve basically got it. The does something is just tell me which postcard to pick.

@B_Mac Check out this free API: Zip Code API Documentation
You can determine the distance between to Zip Codes and the result will be returned in JSON format that tells the distance in either km or miles.

Maybe you can run customer's zip code through the API comparing it to a list of Zip Codes that are from your card. And you specify like "If the distance between the customer's zip code and this zip code is less 10 miles then use card y"... etc.
I looked at this earlier. I thought it could only prepare two zip codes? Am I looking at it wrong?
 

B_Mac

Redneck Oligarch
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
480%
Apr 10, 2017
119
571
Southwest Virginia
Why does it have to be by distance? Why not just separate the USA into 8 different "zones" and choose a landmark for each zone? Then cross reference the customer's ZIP code to a database of ZIP codes that correspond to a specific zone (you could do this manually if you really wanted to but you don't have to)
I guess it doesn’t have to be by distance. As far as I can tell, putting all zip codes into zones would achieve the same thing. Let me explore this a little. Thanks!
 

Kak

Legendary Contributor
FASTLANE INSIDER
EPIC CONTRIBUTOR
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
494%
Jan 23, 2011
9,719
47,993
34
Texas
@The-J had a fantastic solution

There are a finite amount of zip codes, you could just classify them into zones one time, then just cross reference it with a card number. 1 through 8. That way you are just running a query on a zip and out pops a card number.

And it would be really easy to batch classify them by state. Might take a few hours at most.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

Vigilante

Legendary Contributor
Staff member
FASTLANE INSIDER
EPIC CONTRIBUTOR
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
596%
Oct 31, 2011
11,116
66,267
Gulf Coast
This is the greatest forum in the history of the Internet. Carry-on.
 

Ocean Man

Life-long learner.
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
222%
Sep 26, 2018
902
1,999
United States
You’ve basically got it. The does something is just tell me which postcard to pick.


I looked at this earlier. I thought it could only prepare two zip codes? Am I looking at it wrong?
It looks like you can compare a zip code against other ones. So for instance:
33572
Looking at this picture, let's consider that the zip code 37918, is the customer's zip code. The five zip codes to the right of the customer's is your notecards.

What this API call did was compare 37918 to each of those comma-separated zip codes and returned the distance in miles. Close to the distance that crows fly.

Now that you have the returned distance list, you can for example, loop through each of the returned distances to find the smallest distance. (Note: I'm not sure what you're criteria is with distances?)

Let's give a name like zip code 32003 equals notecard 1 because in this returned example, 32003 had the shortest distance. Because it's the shortest distance between the customer's zip code and the other zip codes would you want to use this notecard?

But looking at @Kak and @The-J, it may be smarter to just list certain regions as a certain card and that way if a customer falls into a certain region then give them this card. I guess both may work.

If you're considering using the API, please consider looking at the pricing model: Zip Code API Plans there are 10 free calls per hour.
Each zip code provided will count as a separate request. For example, if you send 5 zip codes, you will be charged for 5 requests. This is something you should consider, depending on the amount of notecards you have, it could easily pass the free API limit by your second order. In the example I used, I'd literally only be able to call the API twice. Not good if you're having more than 2 orders per hour. If you pay $99 per year, you can bump up to 200 API calls per hour which is 40 products per hour if you have 5 zip codes/notecards.

Mileage may vary depending on the # of cards/zip codes you want to compare against.
 
Last edited:

Ocean Man

Life-long learner.
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
222%
Sep 26, 2018
902
1,999
United States
@B_Mac, here's some helpful resources to help you get started if you're considering a private Shopify application. I'd like to pass on this information to you because when I started developing on Shopify, there was much information and it was difficult to do things myself. Hopefully these tips can save you time.

1. It sounds like you're going to want to do this for each webhook, so for this, I recommend looking at "How to create a Shopify webhook": Webhooks. Looking at the webhooks that Shopify offers, it does seem like you have the ability to create a webhook for "Order creation: a webhook will be sent every time an order is created." This page not only tells you the available webhooks but also how to create one. You're going to need a software (private application) in place/running in order to have a place to actually receive the order data.

2. Consider making a private/unlisted application rather than a public application. The difference is that a public application would allow other people to install your application and more used for being on the app marketplace. I don't think that's your goal. It is far easier getting started with a private application than a public since a public application requires much more authentication and authorization. Page that describes the difference: App types

3. When developing an application consider using Shopify's new CLI APP: The Shopify App CLI: A Tool to Help You Build Faster it'll make the process of creating an application much more easier. Not all of the hard work goes away but a lot of it does. This CLI application creates the boilerplate for a Shopify app in either Node/JavaScript or Ruby on Rails.

4. Consider hosting, is this an application that you'd like to keep running 24/7 or only when a webhook comes in would you like the application to execute? They're a different cost structure, keeping your application running 24x7 is more expensive but it's also more faster as the cost-per-execution model has a cold-start but it's more cost-efficient. I typically use Azure for my software but you can also consider something like Google Cloud or AWS. What you need to do seems like a good fit for a simple AWS Lambda function or Azure Function.

Do you know what you want it to do after it determined which notecard to use? Do you want the application to update the order to have the information on which notecard to use? This is something to consider.

Seems like your process is:
1. Create a order webhook that sends data to your Shopify application every time an order occurs.
2. Have the application process the order data, maybe using the API I previously mentioned (again, look at the pricing model) to determine which notecard to use.
3. Finally, what do you want it to do when it determines the notecard to use? Update the order? Etc...

I hope this information helps, I definitely could of used it when I was first starting out. You can use it for yourself or pass it onto another developer and they should get the gist of what you want to do.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

Post New Topic

Please SEARCH before posting.
Please select the BEST category.

Post new topic

Guest post submissions offered HERE.

Latest Posts

New Topics

Fastlane Insiders

View the forum AD FREE.
Private, unindexed content
Detailed process/execution threads
Ideas needing execution, more!

Join Fastlane Insiders.

Top