Where to find the selectCallback on the minimal theme

Tourist
20 0 1

I've been fighting with this for a while.  I'm using Minimal version 3.3.1

My site is https://bumble-bee-pottery.myshopify.com/

I FINALLY HAVE THIS WORKING !!!!!   Almost !!!!

I did just what Tim said and posted the jquery code right above Show SKU in theme.js.   I then added

             <div id="variant-inventory">

                </div>t


to product.template.liquid

I now show my variant quantities correctly when the vatiant selector is added.

ONE final question.  I've added a quantity selector onto my product page so that customers can choose n number of mugs before going to cart.  I added a max value to the input in order to not allow the customer to select more than I have in inventory.  That max value gets me back to the max value is ALWAYS the max value of the first variant.  How do I set a variable from theme.js that the quantity selector in product.template.liquid will recognize ?

 

0 Likes
Shopify Partner
2522 25 549

Hi Helene, 

it would be very nice to see the actual page you're talking about -- it makes it easier to suggest a proper solution. As far as I can tell, on the site in your signature,  the quantity selector html is similar to this: 

<input 	type="number" 
		id="Quantity" 
		name="quantity" 
		value="1" 
		min="1" 
		max="{{ product.selected_or_first_available_variant.inventory_quantity }}" 
		class="quantity-selector">

Since max value is done in liquid, it's not updated when you select variants in your browser. However, we may try to update it by extending that piece of code with something like:

/* find the qty selector */
var $quantity = $('#Quantity'); 

/* what's the new limit? 99 if do not care */
var max = (variant.inventory_management == "shopify" && variant.inventory_policy != "continue") ? variant.inventory_quantity : 99;

/* what's current qty selected? */
var current = $quantity.val();

/* set new max */
$quantity.prop('max', max);

/* if currently selected more then new max, reduce to new max */
$quantity.val( current < max ? current : max );

This code should go together with the old code, right below the if(variant ) {  line.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
Tourist
20 0 1

Tim, yes.  I tried putting that code in from another google search when I put the quanitity selector on the product page and discovered I could order as many as I wanted to.  Because of the length of time it takes to hand produce even a simple piece of pottery I must limit the customer to ordering no more than I have on hand.  I'm trying to avoid the bad customer experience of waiting until the shopping cart to find out they've attempted to order too many.

 

The site is https://bumble-bee-pottery.myshopify.com or www.bumblebeepottery.com

For an example (because I don't use very many variants)  :

From Home Page Select Pocket Minders from the Shop Now menu

Select Melting Clock as the item

Necklace with beads has 3 items ininventory

Necklace without beads has 5 items in inventory

While I'm asking about this quantity selector, one additional question.  Where do I change the word "Quantity" above the selector ?  Is it under 'Language' or is it in code ?

I very much appreciate your help.

Helene

0 Likes
Shopify Partner
2522 25 549

Ha-ha, I've spend quite some time to find a product with several variants yesterday and could not :)

And yes, the code I suggested should work fine to do what you need. You should make a theme copy and try it in unpublished theme first, though.

Now, Minimal being from Shopify, the wording is definitely is under "Edit language". Look at Products->Product:Quantity.

Love your stuff. The droplet-shaped mugs are not quite my cup of tea :), but the teapots! ...

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
Highlighted
Tourist
20 0 1

Thanks Tim. Do I just replace the input line with the code ?  I appreciate the kind words on my teapots. I love making them. The mugs are unique in shape. I never make round ones. Everyone else seems too. 

I can't tell you how much I appreciate your help with thi

0 Likes
Shopify Partner
2522 25 549

No, in the code you've initially pasted into theme.js.liquid, insert the new code right  below the if (variant){ line.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
Tourist
20 0 1

Works perfectly !

I would love to see this code put into the theme as part of the base code.

0 Likes
Shopify Partner
10 0 0

Hi Tim,

I'm using the MINIMAL theme.  All I want is to show the stock inventory/stock level on the product page.  

Kindly show me the step by step process.  I'm not really a tech-savvy person, but I can follow basic codings.

Hope you can guide me through.

Thanks and take care

Edgar

0 Likes
Tourist
20 0 1

Tim, are you still helping wayward shop owners ?   I now need help with this again and I'm hoping you can help make a suggestion.  In prior discussion i wanted variances to have their own inventories and then show it on the product page.  Plus not let customers order more than I had.  With your help that all works great.   But, variances were actually items that had their own inventory counts.

 

Now I need to be able to add 'Options' and have the inventory from any option selected remove from the first variance.  It's kind of like I need what it did originally if it's an option, otherwise do what we did if it's a variance.

 

I've changed the code per your instructions to make variance work but now I don't know what to add to make 'options' also work.

 

I hope you're still out here helping people.  You were wonderful helping me before.

 

1 Like
Tourist
11 0 1

@Helene_Fielder

 

Thanks to you and Tim, but, I'm trying to figure out exactly which code you ended up using on your site to get both variant and non-variant items to properly display quantity on the product page.

 

I am using the Minimal Theme at paintedheirloom.com.

 

And I actually love all your work!  I think I'll be buying from you in the future!  Love the uniqueness! 

 

Vonda

0 Likes