Show inventory quantities in Brooklyn theme

Highlighted
New Member
2 0 0

Hello,

I have been trying to set up show inventory quantites in the Brooklyn theme. I can set it up to show for only one product but not it's variants. I am looking for the selectCallback function. Can anyone tell me where I can find this? Thanks

0 Likes
Highlighted
Shopify Expert
2684 67 818

Hi Dana,

in Brooklyn theme this function is no longer used.

You can do the following

1. Add the following code in your product-template.liquid  You should keep the span and span id.

<hr class="hr--small">
 <h4> <span id="inventoryQuantity">{{current_variant.inventory_quantity }}</span> available. <h4>
<hr class="hr--small">

2. In your theme.js.liquid locate the function  productPage: function(evt) { and in this function below the line  // also show SKU  (about line 2039) add the following

 $('#inventoryQuantity').html(variant.inventory_quantity);

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
New Member
2 0 0

Thank you so much! I have tried everything and this is the ONLY thing that worked for me! I apreciate you so much!

 

0 Likes
Highlighted
Excursionist
20 0 5

Can you tell me if I I could use this same solution on the Debut template?

Thanks!

0 Likes
Highlighted
Shopify Expert
2684 67 818

Hi Crystal,

for the Debut theme the javascript part is in different place. Note, however, that this is a quick-and-dirty one-liner solution, the proper one will require creating a couple of functions in different places...

Open your theme.js Asset and aroung line 535-540 find this piece of code:

      this._updateMasterSelect(variant);
      this._updateImages(variant);
      this._updatePrice(variant);
      this._updateSKU(variant);
      this.currentVariant = variant;

then paste that line of javascript code right after.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
Excursionist
20 0 5

Wonderful! It worked beautifully! Thanks so much!

0 Likes
Highlighted
New Member
1 0 0

Hi Crystal,

The code on mine only goes to 1434 in Brooklyn. Any idea where the quantity for variants goes.

 

Thank!

0 Likes
Highlighted
Shopify Expert
2684 67 818

Hi Bill, you should look for the function productPage: function(evt) in  theme.js.liquid  asset. 

This solution is for the latest version of the sectioned Debut theme, if yours is an older one you should probably look for selectCallback function in product.liquid.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
New Member
3 0 0

Tim,

Thanks! Worked like a charm

You're a life saver. 

0 Likes
Highlighted
New Member
3 0 0

Hi Tim, 

I am also using Brooklyn theme. Step 1 was fine, but I am unable to find the function productPage: function(evt) in the theme.js.liquid asset. Nor around line 2039 neither on the rest of the asset. Actually there is only 1455 lines of code there. Am I maybe using an older version of Brooklyn? I started last december, one month earlier than this thread, so tehcnically it could be possible...

Thanks in advance,

Maria

0 Likes