Variant selected in Brooklyn theme. In stock, Out of stock or incoming date.

Solved
Highlighted
Excursionist
49 4 3

I want to show specific information on product page when variant selected. Ive tried to accomplish this with liquid but i guess i need JS on selectCallback for it.

This is the liquid:

{% for variant in product.variants %}
{% if selected_variant.inventory_quantity > 0 %}
In stock! Delivery 1-3 days.
{% elsif selected_variant.incoming %}
Back in stock {{ variant.next_incoming_date | date: '%A %d %B' }}.
{% else %}
Out of stock.
{% endif %}
{% endfor %}

 

Ive tried to make this work in Brooklyn theme in

product.liquid under selectCallback

timber.js.liquid

variant_selection.js

 

Can't make it work

Anyone made this work?

0 Likes
Highlighted
Excursionist
49 4 3

This is an accepted solution.

Solved it

var selectCallback = function(variant, selector) {
    if (variant && variant.inventory_management != '' && variant.inventory_quantity <= 0) {
      // Out of stock. Back in stock {{ variant.next_incoming_date }}
    } else {
      // In stock! Delivery 1-3 days.
  }
}

 

0 Likes