How to change in template through the Shopify application - shopify

I am trying to write a Shopify application and I want to add a section to the product page when the store owner installed my app. I tried this by adding a custom script tag in the shop template and this tag will load and inject my desired HTML into the page. It's work but it needs to force the store owner to change the product page template and its not user-friendly.
I see some apps in the Shopify app store that can change the product page after you install them without needs add any part to the product page template. How they do this work? I can't find the correct way in the Shopify documents.

You can change the Shopify theme of the shop using The API for Assets:
However as drip mentioned this is not a good idea:
If you change the theme auto-magically via code, you are looking for trouble. A lot of things can go wrong - simply you cannot cater for all themes and their changes over time! So you could possibly leave a broken page after the change. The e-shop owner won't be impressed! Actually a lot of the 1* reviews of apps are for that reason!
What would happen if the eshop owner removes your app? He won't know what code to remove.
So, most apps ask the user to add the app code. They provide detailed instructions of course.
Fyi, another problematic approach is the following:
Some apps may attempt to change the DOM "on the fly", by first locating an existing DOM element (a lot of theme-specific if statements to do that with any degree of success) and, then insert the app's DOM elements.
That's very messy and problematic as well, but at least you do not risk ruining the owner's theme files. In the worst case he can uninstall your app and he 'll be ok.

Related

The injection Of A Theme App Extention Block Into A Section That Has No Objects In An Editor

I'm creating an app similar to a whishlist in Shopify, and I want users to select products for later on a product listing page.
This is why I created an app block which allows users to do this when it's cliked.
However, I do not understand how I can integrate this block inside the product-grid card component of the theme using just an editor without changing a shop's code directly.
Any help is massively appreciated :-)

How to make a shopify app/theme extension which would get displayed in the brand's store UI?

We have an application which integrates with Shopify Clothing stores. We run our application in an iframe inside the shopify store where it interacts with the store's user.
Right now this application gets integrated with Shopify manually by inserting our script tag inside the store's product page. Can someone tell me how I can do this using a shopify app or theme extension?
Edit after David's answer
Is it also possible for me to get information about standard buttons in the theme like the Add to Cart button or Change Variants input. Ideally I would like to get the selector for these.
You would create a Shopify App that asks for permission to write ScriptTags. The Apps simply installs a script tag pointing to your App. So when the merchant installs your App, they get the script tag. Depending on what your App does in that iframe, you may need your Shopify App to provide other support, but that is not detailed in your OP, so I leave it at that.

Shopify - is it possible to change the preview of a product with a inputbox?

Which ways are possible to edit the live preview of the product page in Shopify with Inputboxes next to it?
Let's say the product is a poster, and i want to add a custom text on it.
When typing into the inputbox the text changes in real time on the product.
Can this be implemented in the shopify code with the basic version of shopify?
Or does this necessarily needs an app?
ADDITIONALLY:
Let me go a bit deeper. I have a code that can generate a QR code.
Now i want that the QR code to be previewed in the product. Now position and color of the QR code is different from any product. Would that need an app?
Yes you can to an extent.
First the ground rules:
You can't modify the product from the front-end and update the content or media in the back-end - this would be a huge security hole
The changes applied to the product will be visible only to the user who changed them
The solution is to use Javascript and update the content of the front-end. If you like to store the changes for that specific user you can save them as cookie or localstorage.
If you like to share this change to other people you will need to add a custom parameter in the URL of the page and generate the content from it and share that url.
Each one of these steps will require some custom Javascript that will affect only the user in question, if you like to modify the product in the back-end directly you will need some kind of an app for this.
On my mind it can be done if the dynamic text is applied over product image.
Detailed code would be too long to write here but here are the steps:
Add an input to your product form to add a custom property (https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503)
Write a Javascript function to get input value in real time
Use this value to display it in a div in product image container
Position this div in CSS as absolute and style it as you wish
While image container position should be set as relative in CSS
HTH

Creating a custom BigCommerce theme from scratch, without selling it in the theme store

A client of mine wants to create their ecommerce site with BigCommerce as back-end. BigCommerce has lots of theme's available in their theme store. This client however does not want to be just another website using a certain theme, but have a theme unique to their company. You can build your own theme which would use your own config.php, something they use to set global variables in their templating engine.
However as far as I can read on their developers site the only way that you could create your own theme is if you then start selling it in the theme store, which of course would allow other companies to adopt this same theme against a certain price. Something my client doesnt want. They want to be unique.
So my question is: Can you create a custom bigcommerce theme from scratch, without selling it in the theme store?
Absolutely, however you can set up a config.php file and all that. You can simply start with any theme available in the current theme store, download the HTML, CSS, JS, Image, etc files and customize them to your liking. These are completely open ended.
You won't really miss anything this way, the only thing the config file does is set the default store settings when that theme is applied such as menu depth, fly out menus, display of weight, etc. All that can be adjusted manually by you or your client in the store settings!
So to answer my own question directly: No, you cannot create a theme from scratch without being a parter of bigcommerce and making your theme available in the theme store.
You can get close as #TheEks describes by simply choosing a theme (preferably the blueprint, available when going in to dev mode), and then overwriting whatever contents the html files have. You will need to check for updates to the bigcommerce theme yourself and implement those in your code. You will not be able to remove theme files, if you no longer use them, from the webdav server, only revert them to their original state. You can just ignore them of course.

How do I switch the theme used on a Sitefinity based website?

We have a Sitefinity 3.2 site in production and the users want a whole new look and feel. Upgrading is not an option.
I have created new templates for them but they will need to go into the site and create all new pages using the new templates. This is a problem because they want the current site to remain unchanged until they are done - then they want to instantly switch over.
One problem that I see already is that pages will not show up in the menu control until they are published.
I am very new to Sitefinity. Is there a standard practice for doing this?
You don't need to re-create all of the pages to change the look and feel; simply change the template assigned.
This video shows how to work with themes and templates.
I'd think that changing the theme of all the templates late at night should be "instantly" enough for most people. :)