App reviews, troubleshooting, and recommendations
Hello,
I want to use this script on my website but cannot find the file to edit the code. I use the DAWN theme.
From instructions:
"Insert something like this at the end of the file theme.js.liquid (visit your theme files in the Shopify admin > Online store > Themes > Live theme: Actions dropdown > Edit code > unfold the Assets folder on the left):"
CODE:
/** * Insert text near the Buy button on the product page. * * E.g. "18 people are viewing this product right now." */ document.addEventListener('DOMContentLoaded', function () { // Minimum view count var minViews = 2; // Maximum view count var maxViews = 20; // Text to show after the view count number var text = 'people are viewing this product right now.'; // Create the new element to display on the page var $viewCountElement = document.createElement('div'); $viewCountElement.className = 'view-count shopify-payment-button'; $viewCountElement.innerText = Math.floor(Math.random() * (maxViews - minViews) + minViews) + ' ' + text; // Determine where to put the new element var $form = document.querySelector('.template-product .ProductForm'); var $pickupOptions = document.querySelector('.template-product .ProductMeta__StoreAvailabilityContainer'); if ($pickupOptions) { // If there's currently an element about the pickup options on the page, insert our view count element before that $pickupOptions.parentElement.insertBefore($viewCountElement, $pickupOptions); } else { // If there's no pickup options element on the page, just place the view count element at the end of the product form $form.appendChild($viewCountElement); } });
Hello @46855004463
It's GemPages support team and glad to support you today.
Dawn theme have not file theme.js.liquid It is use file global.js so you can paste it to this file
If you require any further information, feel free to contact me.
Best regards,
GemPages Support Team
Hello,
This information I managed to google. But when I use the code in global.js nothing happens 😕
Thank you
This data I figured out how to research. In any case, when I utilize the code in global.js nothing occurs. sauces at popeyes
I managed to research and gather the required data. However, when I tried using the code from global.js, nothing happened, and I couldn't get it to work as expected. blue fish happy hour
If you're using the DAWN theme on your website, locating the theme.js.liquid file is crucial for implementing the script. It's a bit like finding the right material for your flooring ; in this case, the code is the foundation of your site's functionality. To edit the code effectively, follow the provided instructions to access the theme files in your Shopify admin. Once you locate the theme.js.liquid file, you can seamlessly integrate the script and enhance the functionality of your website.
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025