Shopify and Some lesson I have learnt from my last project

What is Shopify?

I am developing the Shopify app for the last 3 years. Shopify is an e-commerce platform & ready to go. This platform was developed with Ruby and Rails. So most people think to develop an app for Shopify, need to learn Ruby. That’s not true. Because there has a huge difference between Shopify and other platforms like WordPress, Drupal, or Django. Shopify is not a CMS or language framework like Laravel.  It is ready to go platform. Most importantly it is a premium platform. To open a real store you have to pay monthly.  Just open an account & create your store within 2  min within their subdomain. After that, you can replace it with your custom domain.

Shopify Themes and Apps

You can attach your custom theme or you can select one from their store. To upload a custom theme you are allowed to upload your custom images, CSS, js & liquid files. To get other necessary features you have to install the App. There are 2 kinds of App. One is public and the other one private. It is most likely a WordPress plugin. But there has a difference. When you install a WordPress plugin on your website, first you upload it then activate it. Otherwise, the WordPress plugin won’t work. For Shopify, you don’t need to upload the app. Just give access. It is ready to go. Shopify provides access via API after app registration. You have to use it to develop your app. You have to host your app. Shopify won’t host your app remember it.  They just provide access through API. You can use any language to develop an app for Shopify.

I think understanding the concept is a little bit confusing. Let me explain. Suppose you want to create or modify Shopify products with your App. Then you have to take access to modify or create products from the store owner. After that, you can send a request by following the Shopify Graph/Rest API to create a product with the necessary data.  If you have proper access and you have sent the right payload then it will be created.

Hope it is clear to you know.

My Last Project Lessons

My last project was related to tracking the user without authentication & send push notifications depending on product browsing time and other factors. when you will send a push notification you have the ability to send two-button also with push notifications, especially for windows or android devices.
However,  to create the app we have to remember that if some buyer already bought the recent product he has visited, then we won’t send a notification for that product. That’s the deal.

Actually, I have saved all the necessary data to local storage. When someone enters into the Shopify store by default it sends a cart request to its server via ajax. Depend on this completing ajax event the app sends the cart token and other necessary data to the app server. Using that data app send the push notification to the individual clients. If someone submitted an order to the Shopify store then Shopify sent the order data to the app server by using webhook with that cart token.

One more thing I forget to mention. you have to take the script tag & proxy access to attach your js file to store via the app. This script will work for you. It will load with other scripts.

By following that cart token the app identifies the individual users and gets the details of the product that they have bought. The app can do further steps. But there is an issue that if someone buys a product with a buy now button then the webhook sends the cart_token property null. No cart token is generated for the buy now button. Checkout token is generated though. But the app script hasn’t access on checkout page or order page. so the app can’t send the checkout token instantly. What we can do, then?

After completing the order buyer will be redirected to the thank you page. Now the app script will work and the app has access to the checkout token also. I just save it as a checkout token besides the cart token in the app database. So that when the cart token is empty the app can match it with the checkout token.

With push notifications, you are able to send two buttons. Something like the above image. I am using two buttons here. Buy now and Cart. Generally for other push notifications, the buy now buttons redirect buyers to the shop page, and the cart button redirects to the cart page. But this time for the recent products I have sent buyers to the checkout page for the buy now button with all recent products preloaded and For cart button redirect to the cart page after adding recent products to the cart. How can we do this?

We can do this by using the Shopify permalink.{variant_id}:#{quantity}(,…)?discont=discount-code

we have to follow this permalink to sent the user to the checkout page with the recent product preloaded. Here you can see we have to attach variant IDs of the products. It won’t work for the product id. What if some product hasn’t any variant. Please remember, in Shopify, all product has variant id, even the product hasn’t any specific variant. Under the main product, a child variant is created automatically. You can get this variant code by Shopify product API with the product ID.

Now I have to send the buyer to the cart page with recent products into the cart.[]={product_id}&quantity={quantity}&id[]={product_id}&quantity={qu…}

You have to follow this permalink for it. Pretty simple.

There is a good tutorial on Shopify permalink. You should read it to get more information.

Hope you have liked this blog. My next blog will be on Shopify vs WordPress. Thanks for reading. 🙂

, ,

Leave a Reply

Your email address will not be published.