DEV Community

Mohin patwary
Mohin patwary

Posted on


How can I Display data on an online store from the app server?

How can I Display data on an online store from the app server? I got a guideline, app proxy. but I cannot understand that.

I have created an admin Dashboard for the app following your tutorial. I created successfully a snippet file on the current Shopify theme using asset API. I can pass any HTML code as a snippet file value. This means I can pass any HTML or liquid code in the snippet file. That snippet file was created from my app.

I've added some settings fields for my app. And I can save data into my database.

Now I want to create a REST API to show the data for the Shopify client store. I created an API route.
For API I have created a Controller.

On the controller for the API, I need to run a query based on the same customer ID and the same Shopify shop name to get data from my database. In my database, I saved customer id and shop Name, and product id.

Now, How can I get a Shopify shop name and customer ID in the laravel controller?
So, I can run a SQL query using Shopify shop name and customer-id to get data from my database.

I can easily manage JavaScript to get the name of Shopify Shop. Example:
But how can I customer ID? The customer who logged in and saved the wishlist product.

Also, How can I write javascript in laravel controller or how can I access javascript value in the laravel controller?

I really need this assistance, I am trying to for the last few days. But I cannot find a solution.

Please sir help me

Thank you

Oldest comments (3)

zubairmohsin33 profile image
Zubair Mohsin

If you already have a snippet in theme and can pass Liquid file, you can create a hidden input with value of current customer and then retrieve it.

<input type='hidden' value="{{ }}" id="uniq_customer" />

mohinpatwary profile image
Mohin patwary

Thank you so much sir for responding here.
Actually, I followed the CodeInspire video tutorial. He saw everything in the admin part. But there is no video/guide to show data show online Shopify theme/store from the database,
I was just trying to show data from the app server/database to the Shopify online store.

I am trying to follow these instructions,

But I can properly understand these instructions. Could you please help me, sir? I will be really grateful to you.

Thank you

zubairmohsin33 profile image
Zubair Mohsin

Also make sure to check YouTube tutorial series by CodeInspire on building Shopify App with Laravel. He also builds a Wishlist app as an example in his tutorial.

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<