How to get my shopify app files included in the theme?

Highlighted
Shopify Partner
9 0 0

Hello Team,

 

I hope you are doing well.

I am creating a Public App in Shopify. The app is for Product Listing, built in Ruby on Rails. It working fine in the admin panel. I am able to show products & their details. Now my aim is to connect the app with the frontend (website). I have used app proxy for connecting it with frontend but, for that, we need to specify a URL, in my case /apps/{{sub-prefix}}

Now I wanted to know how we can include my assets in a theme whenever the user is installing it from the URL. Like we Install "Product Filter & Searchby BoostCommerce", then in theme, files are automatically added in Snippets, Assets, etc. Please guide me on how to connect it.

 

Some examples or code samples would be very helpful.

0 Likes
Highlighted
New Member
2 0 0

hi,

If you want to add file theme side then shopify provide api you can connect theme and insert your code theme side. shopify provide AsssetAPI and ScriptTagAPI you can read both api docs.
ScripttagAPI :- https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag?api[version]=2020-07

AssestAPI :- https://shopify.dev/docs/admin-api/rest/reference/online-store/asset?api[version]=2020-07

Example

#This will access the asset of live theme
@assets = ShopifyAPI::Asset.find(:all)


#or if you want to access the asset of particular theme.
@assets = ShopifyAPI::Asset.find(:all, params: {"theme_id": themeid})

#You can access the theme API to get theme id from below:

@themes= ShopifyAPI::Theme.find(:all)

0 Likes