Top

Where can I look for the JavaScript function?

File names vary by theme, often the file can be found within the "Assets" of your theme. Sometimes the JavaScript function can appear in the product.liquid or theme.liquid "Templates".

To find these files:

  1. From "Shopify Admin", select Online Store.

    select online store 

  2. Select Actions.

    select actions 

  3. Select Edit HTML / CSS.

    select edit HTML/CSS 

Some files to look for are:

  • Layouts
    • theme.liquid
  • Templates
    • product.liquid
  • Assets
    • ajaxify.js.liquid
    • shop.js.liquid, or
    • a file with the same name as the theme, (example: radiance.js.liquid)
Theme File Location Line # Instructions
Launchpad Assets > scripts.js 15 Find $('form[action="/cart/add"]').submit(function(e) { 
Add our code directly below this
launchpad-star
(2015 and earlier)
Assets > scripts.js 80 Just after animate(); in the Shopify.onSuccess function
launchpad-star
(2016 and after)
Assets > theme.js.liquid 219 Immediately after
success: function(lineItem) {
Symmetry Assets > main.js 689

under 
  $.post(shopifyAjaxAddURL, $form.serialize(), function(itemData) { 

 

You'll need to remove the height: auto; from sytles.css.liquid for .content img,
.content iframe,
.content embed,
.content object 

Couture Assets >  ajaxify.js.liquid 93 under Shopify.onItemAdded = function(line_item, form) {
Reign Layouts > theme.js 363   Shopify.onItemAdded = function(line_item) {
if(typeof(upsell_offer) === "function"){ upsell_offer(); } 
Shopify.updateMessage( line_item.title, ' was added to cart', line_item.image);

Shopify.getCart();
};
Radiance Assests > Radiance 216 Add right below "function addToCartSuccess (jqXHR, textStatus, errorThrown){"
Megatronic Assets > theme.js 80 Add right below "  function addToCartSuccess (jqXHR, textStatus, errorThrown){"

Minimal Assets > scripts.js 70 Add right below   $('#product .add-to-cart').click(function(e){


Retina Assets > app.js 454 Immediately after -  success: function(itemData) {

Clean Assets > blackandwhite.js 711 Add right above         var jqxhr = $.post('/cart/change.js', { 'quantity':newVal, 'id':varID }, function(data, textStatus, jqXHR) {


Blockshop

Assets > shop.js

643

Add right below: 

    addToCartPass = function(product) {

Supply

Assets > ajaxify.js

161

Add right below:
Shopify.addItemFromForm = function(form, callback, errorCallback) {

Atlantic

Assets > site.js

979

Add right below:

          quantity = this.$(".product-quantity").val();

Fashionopolism

Assets > theme.js

194

Add right below:

   cache: false,
   dataType: 'json',
   success: updateCartDesc
   });

Ella

Assets > ella.js

 

Look for: initProductAddToCart: function() {

and then go down around 21 lines from there, until you see a return false;

place the upsell call above the return false;

Canopy

Assets > scripts.js

298

Add above:

//Add to cart
$.post(shopifyAjaxAddURL, $form.serialize(), function(itemData) {

Expression

theme.liquid

71

Add below:

$('form[action*="/cart/add"]').submit(function(e) {

Have more questions? Submit a request