How I Actually Built My Shopify App (3 Failed Approaches and 1 That Worked)

In my previous blog, I talked about why I decided to build my own Shopify app to solve COD return problems. Today, I'm sharing the messy reality of how I actually built it.
Spoiler alert: I failed three times before getting it right.
Approach #1: The Discount Coupon Idea
My first idea seemed simple. Instead of product bundles or variations, I'd use discounts. When customers selected partial COD, the app would create a discount coupon and auto-apply it at checkout.
I opened a Shopify Partner account, created a Remix app using their CLI, and dove in. The folder structure was overwhelming. Lots of React files and boilerplate code I didn't understand.
The hardest part? Prisma and SQL. I was used to MongoDB and Mongoose. But I wasn't planning to code everything myself anyway.
Enter Claude Code.
I explained what I wanted, and it started writing code. The initial version didn't work, but I could see something was happening in my store. That was promising.
But then I hit a wall.
Shopify Checkout Extensions work independently from your main app. They have limitations that make it impossible to automatically apply coupon codes. The best I could do was provide a coupon code for customers to copy and paste.
That worked, but there was another problem. Checkout extensions can't communicate with your app's backend. All the data I needed was blocked unless I upgraded to Shopify Plus.
I was on the basic plan. Approach #1 was dead.
Approach #2: The Pre-Checkout Layer
Since checkout extensions couldn't talk to my backend, I needed a different strategy. I thought about adding coupons before customers reached checkout.
I was about to give up when my sister showed me something interesting. She found a website (casebasket.in) that had partial COD integration with Shiprocket payments.
I immediately checked what platform it was built on. Wappalyzer said Shopify.
That was my aha moment.
Why not use Shiprocket? Because I'd have to tie up with their logistics service, and my site works on a Print on Demand model. I needed my own solution.
But I could copy their approach.
I built a pre-checkout layer. Before customers hit Shopify's checkout, they'd land on my custom checkout page. They'd fill in their details, choose between prepaid or partial COD, then get redirected to Shopify's checkout with everything pre-filled.
For partial COD orders, the coupon code would already be applied.
I got this working within hours. Finally, progress!
But wait. There was a massive flaw.
The Coupon Stacking Problem
My app worked perfectly, except for one thing. Customers could stack additional promotional coupons on top of my partial COD discount.
This turned partial payments into completely free orders. The order total would hit zero, and customers would checkout without paying anything.
That defeated the entire purpose. The whole point of partial COD is that customers have skin in the game. They're more likely to accept delivery because they've already paid something.
I tried to prevent coupon stacking, but Checkout UI Extensions don't allow that level of control.
Approach #2 was also dead.
Approach #3: Payment Gateway Integration
By now, I was getting desperate. But I remembered something about that website my sister showed me. They weren't just applying discounts - they were actually processing payments through Shiprocket's payment gateway.
Why not integrate a third-party payment gateway? I was already using one for other projects.
This became my backup plan, and honestly, it should have been my first approach.
I worked for three straight days on this. After testing 20-30 checkouts, I finally had a working solution.
Here's how it works now:
For Prepaid Orders:
Customer fills details on my pre-checkout page
Gets redirected to Shopify checkout with pre-filled information
Completes payment through Shopify
Done
For Partial COD Orders:
Customer fills details on my pre-checkout page
Pays the partial amount through my integrated payment gateway
Shopify API creates the order automatically
Customer gets email with full order details
Admin sees order tagged as "Partial COD" with delivery amount in notes
What I Learned
Building this app taught me more than I expected:
Keep trying different approaches - Don't give up after the first failure. Each approach taught me something new and opened up possibilities I hadn't considered
Shopify has limitations - Extensions sound powerful but have real constraints
AI coding tools are helpful but not magic - Claude Code sped things up, but I still had to understand the problems
Sometimes you need to see working examples - My sister's random discovery saved weeks of trial and error
The app does way more than just partial COD now, but that's a story for another blog.
The Real Win
Sure, I solved my COD return problem. But the bigger win is that I actually finished something. For someone who jumps between projects constantly, shipping a working product feels pretty good.
If you're thinking about building your own solution to a business problem, just start. You'll probably fail a few times, but that's part of the process.
What did you learn from your latest project? Let me know in the comments.
Next blog: I'll dive into all the extra features this app ended up having and the trial-and-error process that made it robust. Stay tuned!
Join the conversation
Sign in with Google or GitHub to share your thoughts
Loading comments...