Shopify - Embedded App - User session and webhooks - shopify

I'm fairly new to Shopify development and I'm trying to understand the best way to address our requirement. Apologies if some of these are basic questions.
The intent is to build an embedded public application that is intended to:
Have a floating component that's present on all pages on the online
store.
React to the user journey e.g. do stuff when the user adds
items to cart, completes a checkout, etc.
Send events to our server through the journey to allow our server to provide relevant
info, regardless of the store theme.
Have the ability to do this at an individual session level i.e. not all users will have the same experience.
I had a few questions around this:
Will it be possible to add the script to the main theme page and
have it load on all pages?
Is there a better alternative, particularly if the integration is supposed to be light-touch for admins?
What is the best way to get access to the individual user session from the app (assuming we can request the appropriate permissions as a part of the app installation)?
Is app bridge and session token required for this?
Is it possible to build this app using Angular? I understand Shopify framework is API-based and in theory any UI framework should work, but will a deeper linking with the user session be possible with Angular?
If we get enable web hooks for the various events, would it be a reliable way to detect events happening in the user journey? If so, what will be the correlation id between the events from the app and the web hooks?
Is it possible to detect the page the user is in, regardless of the theme? For example: Is there a way to identify that the user has added an item to the cart regardless of the theme used or is a webhook our best bet for those events?
Thanks in advance!

There is one thing you can do that would support most of your needs. Create an App, and set that App up with a Proxy. Shopify will then support the customer centric store theme to use a secure Ajax callback to your App using the proxy. So you can always call a proxy like /tool/customer_check with or without a customer ID from anywhere in the store.
You can imagine how powerful that is. You can return Liquid or more commonly, JSON. Boom! You're in business.
Of course, there are alternatives, all with the caveat your mileage may vary. None of this is predicated on any particular tech stack, meaning you can use what you like and know.

Related

Shopify app for altering the default checkout procedure

I need to create a solution for altering the checkout process.
Better said, I need to add some functionality to it with a remote app (I am not sure if this is the right way to do it).
Mainly, what is needed represents a process that calls an external API, using a private API key from a delivery company, that registers a pick-up from the buyers house and sends the product to our headquarters.The process should be started when the user completes the entire checkout system from shopify, after payment.
After that, some AWB should be returned to the users checkout page, or some response regarding the creation of the pick up.
My question is, let's say, using some language like javascript with node and Koa or express, how one can achieve that? I can't find any tutorials or something that would help me do this.

Shopify - how to extend a checkout page in app?

I would like to create a Shopify app that adds an additional section to the checkout page - a possibility to select the delivery time window. I know that such apps already exist but I want to use my own application server to generate the values that can be selected.
What is the best way to approach this? I've spent last 2 days browsing shopify documentation and following various tutorials but I'm still confused. I thought that application bridge would be the way to go but after playing with it a bit it seems that it only allows to embed application frame in the admin panel, not on the checkout page.
Should my app send a script tag that would call my server and add the whole slot selection UI in javascript? Or should I maybe modify the templates somehow? Can I even make AJAX requests to third party servers from templates?
I would appreciate any advice.
Shopify revealed that there will be a Checkout Apps support soon, but that time isn't now.
So at the moment the Checkout page is standalone and you can't use the ScriptTag API in it.
If you are on a Shopify Plus account and you contacted Shopify to allow you to modify the checkout.liquid file you will be able to add your section manually.
With some additional JS logic you can pass the delivery time to the cart.attributes so that it will be present in the order info. But that's pretty much what you can do and only if you have a PLUS account.
If you plan to make larger modifications you will have to create an App that will have a custom checkout process... which will be a huge overkill for adding a single section, but that's a solution as well.

Shopify Theme and ScriptTags

I'm new to Shopify app development and am a little confused with regards to the difference between ScriptTags and the Embedded App SDK.
My understanding, which might be incorrect, is that ScriptTags are best used to add functionality to the store front and that the Embedded App SDK basically allows you to integrate the administration portion of an app in the site merchant admin section. Is this correct?
Furthermore, if my app was to display an interface (i.e. a dialog with some options) to users via a ScriptTag is there anyway to integrate it into the site theme? Or would I simply add my theming, either dynamically via JS (potentially allowing merchants to edit default settings via the admin) or by loading an external CSS file via the ScriptTag (or both, I guess)?
Regardless of which approach taken, there is always the possibility that the site CSS could interfere or negatively impact the app-generated content. Is it common / best practice to reset the CSS used in a custom interface?
I am not sure I have understood your question clearly.
But I think you are referring this.
https://help.shopify.com/api/reference/scripttag
1) You can't create a new page with the scripttag in Shopify.
2) You can't save any data with the scripttag within Shopify.
You can submit your customized form, but Shopify can't accept and process that form.
Because the scripttag represents javascript and the javascript is only for client side programming.
I hope this could help.

Bigcommerce - Implementing custom code that runs on server-side to create multiple versions of page for a product?

I'm new to Bigcommerce but experienced with web app development. I have a need to make customizations to a Bigcommerce store where I need to implement custom logic that runs on the server-side which affects the output in the UI by deciding which page to serve. For example, I want to have different versions of a product page for different locations. I want each version to have a static URL, however, for SEO purposes. I need to implement logic in the server-side to do something like detect user location based on IP and then determine which of the product version pages to serve. I realize I can do this with JavaScript but I don't want to as I don't think that would work as well for SEO.
I have looked over their API and templating briefly but am not seeing a real way that this is possible. Wondering if anyone can guide me in the right direction or is Bigcommerce too simplified to allow this sort of customization?
You do not have server side access on Bigcommerce. The only would to do this would be client side with javascript.

Tracking query strings in Shopify, using webhooks and admin options

I was redirected here by Shopify support. I have three main questions for a project I'll be working on and wanted to see how possible some of the things would be.
We are looking to develop a plugin for use with Shopify to track purchases through the use of a link shortener (to see which link referred what purchases, etc.). I have a few questions that I'm not 100% sure on even after reading through the documentation.
The first problem that I seem to have is tracking the query string that the link shortener appends to the URL once it redirects. For this service, they use "?visit_id={hash}" and I need to be able to access this--at the very least on the "Thank You" page after an order. I saw in the docs that there is "landing_page_ref" (http://wiki.shopify.com/Order#landing_site_ref) but considering our query string is "visit_id" instead of one of the acceptable parameters, how would I be able to use that query string?
Lastly, I just have a question about how webhooks work with plugins that are on the app store. I know I can just call webhooks to wherever I want, like my personal server, but if this app gets onto the app store, I obviously don't want to hook everything to my own server. Is there a way to make it run on the store itself, and which URL should I use?
Lastly, what is the preferred method for handling configuration options for the plugin? Is there a way to hook into the admin backend or would all configuration have to be in a file within the plugin?
Thanks,
Andrew
I'll do my best to answer these for you. It sounds like you're used to building plugins for something like Wordpress - Shopify apps are a bit different.
You can't access anything on the thank you page for the order.
The thank you page/checkout process goes through a secured Shopify page that you don't have access to - so if you want information about what your URL shortener attached to the store pages, you'll need to retrieve it while they're on the page (using something like a ScriptTag + Javascript to track the query string), or hope that it's inside the Order when you retrieve it later (using the API or a webhook).
Webhooks need to talk to a server you run.
They send the information to you, and then you process it and deal with it. If you want to use webhooks, you will need to run a server with your app on it for the webhooks to talk to.
You manage your own config.
Because you're running your own server to handle those webhooks, you handle configuration for your plugin there. The apps I've worked on typically have their own database for managing configuration options, as well as an admin panel to manage them (it's what the user accesses when they click 'Log Into [Your App]' on the "Manage Apps" screen).
You'll need to run your own server to host your Shopify app.