New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explanation about linking custom setting implemented from app to shopify website #21
Comments
Hi @rubycis I hope I understand you correctly. You want your app connected to the "Front End" or Shop so that you can add functionality for your customers and visitors to use. If so, you need to enable the app proxy part of your app in the partners dashboard for that app. |
Thank you so much myjanky 👍 |
No problem, you are welcome. So no, the proxy URL is not a complete new page in shopify frontend. You can add it to any template (or layout, snippet, asset), to get the result you are looking for. Let me know what kind of front end functionality you are looking to implement and I may be able to steer you in the right direction. The Proxy URL allows you to keep your store secure and prevent CSRF or XSRF attacks. By creating a /apps/customize type of URL for your store (you do not have access to add your app server domain to the CORS origin on Shopify) it will call your app server to retrieve the content without the need to setup CORS. |
As you told me "you can add proxy URL to any template (or layout, snippet, asset), to get the result you are looking for." Can you explain me how this can be implement? Because in app section of partner dashboard we need to add a single url. So I don't understand how this can be implemented in the shopify collection, product etc template file or snippet. |
This can be implemented in several ways. Create an asset JS file and save something similar to the following.
Sorry for the formatting above. Now that you have this piece you can add more functions to it based on the URL params being sent to the app server via the proxy URL. |
here is a gist I made for this. https://gist.github.com/myjanky/fea449e74830c86aed6a83d2e02ead3b |
Hi myjanky |
Sorry about that. I did not add the element with the "data-product" attribute. add this to product.liquid to get the product.id as long as you are using this with product.liquid you should be ok, but other file files like collection.liquid will need some heavy edits depending on what you are looking to do. |
Larry how you doing pal, I have kind of the doubt here with this part of the proxy and the frontend store modification like in the example you provide with the URL .../customize/ how can you modify for example a product name by adding some word in the product.liquid template? and I see you are using a js to do so, are you using a php file to inject the js to the desire view ? by the way can I get the checkout,liquid even if the shop that in runnig my app don't have a plus account plan ? |
Doing good, thanks! you? Without knowing the full scope of what you are going after, this could be done with Liquid and a bit of js magic.
also you could pass query params to /proxy_url whatever that is (like /customize). It just depends on how you plan on using the app proxy url. |
great ! and the checkout.liquid just to add a couple of plane text lines ? |
pretty much the same but you would need a Plus account. Unless it is static text than you could add it through a css content var, although I could be mistaken on that. |
well that a reasonable doubt since the API doc didn't mention the need for a plus plan to modify the checkout.liquid (just adding text) by an app, I fact it says about the plus plan if the store owner wanna change the checkout manipulating the liquid. Have you ever try to PUT some text at the checkout.liquid of a developer store ? |
Great but remember I wanna do the text injection to the checkout.liquid using the app proxy without touch the liquid itself |
In the first pic you try to create a new layout base in checkout.liquid ... thats because you have a plus account right ? |
well there is this additional scripts in the admin where you can add some js for things like google tracking and such. I would try it there but I have never had a use case where I needed to get data from the app server on the checkout page. It should work but remember the checkout for shops that are not Plus are hosted at checkout.shopify.com and not somestore.myshopify.com. This is why I am unsure the app proxy will work this way. |
hummmmmmmm I see it is just to put some text at the left side in the checkout |
what about adding the text to a custom image and uploading it as the background image in the customize theme option? |
Humm no, that wont work for me, look what I really need is to change some content in the template automatically without touching the liquid file itself, I saw I can do so through the Asset API I just don't know how to do it. Any idea ? ohh Larry by the way this is a public App not a private one, the product name will change with content set using the app and modifying the product name automatically, since the app will be installed en several shops we cant touch the liquid, that's the reason we need to accomplish this using the Asset and like so far we cant not determine the tag containing the element we need to modify there is another concern. because one shop may use a "h1" with class name to place the product name and another shop may use a "p" tag or whatever to place the product name and so on. |
The issue with that understanding is that the Asset API gets or puts theme files and can modify those. the docs need to be updated to reflect these restrictions. So your app users will log in and load your app, make content changes they want to appear as the product title then save it. When customers Checkout, you want the app users content to be displayed instead of the default product.title? If so, this could be done using the new Shopify Scripts. (Plus account required.) |
ok checkout appart, this is perfectly accomplish for the rest of view, like product detail view and product list, collections etc ? |
so how can I modify the name of a product out of the checkout page ? in all places but in the checkout using data placed through my app ? |
Larry how much cost the plus plan ? |
Yes, you can use for the rest of the page views that use product.title. The base cost of a plus plan is $1200 per month. |
Also, try to install a few apps and poke around in the code that was added to your site. It may clear any misunderstandings and also give you ideas on how to implement what you want. |
How to add webhook for particular store on app deletion |
Not sure I understand for a particular store. I usually add the webhook on app install. When app is deleted the webhook is called and the app server runs the api command to remove the assets your app installed. Most apps just leave the assets behind in case of reinstall. |
Thank you myjanky. Will get back to you for help if any. I am new to this app development |
Hi myjanky. I have did what I want to do with the help of your knowledge Thank you so much. I have a issue. When the Shop owner clicks on my APP from their admin/apps. My app is loading in the iframe. where shopify passing the following Using this how can I generate acccess token? I am using OhShopify unofficial library. where the following function which need the parameter code. How can I get access_token with the above url parameters which does't have the code parameter.
|
Yea that is the same as this library just written differently.
|
How to show order data in every page? |
Such as when a customer is logged in, their order data from previous orders is displayed on all the pages they navigate to? If so, I would do it without an app and use something like this on the frontend. https://help.shopify.com/themes/development/templates/customers-order |
Thanks for the response . |
You can do an ajax GET to the proxy URL and that will call the URL you have pointed at your app. then do something like place in theme.liquid or where ever you need it on the shop. |
Its showing 404 (Not Found) error This code is in my proxy controller |
screenshot what you have set for the app proxy in the partners dashboard |
can you post the JS code that calls /app_proxy page? |
These codes are in theme.liquid <script> $.ajax({url: " marmeto.myshopify.com/apps/latest-bkm",cache: false}).done(function( html ) { $('#custom_app').append(html);}); </script> |
Not sure but I think it is '{url: "/apps/latest-bkm",.....' can you console.log the error? |
There is no error in the console . |
How did you obtain the 404 page not found error? from before? are you still seeing that? |
are you using private app credentials? i see a 500 internal server error. |
404 error is not there. def index |
I checked heroku logs |
what library is the ruby code coming from? |
I have used the shopify_app gem v 7.2.8 |
Yea that is way out of date. I suggest using the app proxy already available in the 7.2.8 (7.3 is latest) |
I have used AppProxyVerification. |
what do you have for your template for index (def index)? Path is nil may be due to def index not being defined. It's too hard to determine where the issue is coming from. |
index.html.erb ` It is the default one and was working on the proxy url After I tried getting order data it stopped working saying `There was an error in the third-party application.` And read_order scope is there in shopify_app.rb file . |
It might be that the App proxy does not allow access to these resources. |
Hi,
I have created partner account and created app as well. I have integrated the library also. Done with app installation and authorization.
Now I am stuck for next step. I don't understand how can I linked the custom setting implemented on my app to shopify frontend. How can I linked the app database to shopify website.
How can I implement a page on shopify website for customer to customize any product and where I save all the customized data and how can I linked that data with shopify website.
I am able to make standalone app with php but don't understand how it's data can be linked to shopify website. How my local app database can be used in shopify website.
I am new here. Any help is very much appreciated.
Thanks
The text was updated successfully, but these errors were encountered: