Help with my javascript code for updating SKU when variant selected

Highlighted
Tourist
29 0 1
{% assign current_variant = product.selected_or_first_available_variant %}
<div class="my-barcode"><span>{{ current_variant.barcode }}</span></div>

is my liquid code

 

 $module.gfV3ProductVariants({
    mode: mode,
    blankOption: blankOption,
    blankOptionText: blankOptionText,
    style: style,
    onVariantSelected: function(variant, $select) {
        var barcode = variant.barcode;
    jQuery(".my-barcode span").html(theme.currency.moneyformat(sku,theme,moneyformat))
    }

 

i know the jQuery line is incorrect, how can i fix this so when i select a variant, the product barcode auto updates??

0 Likes
Highlighted
Tourist
29 0 1

for anyone wondering, i got the code that is used for updating my prices when variant is selected and tried to modify

 

here:;

 

  $module.gfV3ProductVariants({
    mode: mode,
    blankOption: blankOption,
    blankOptionText: blankOptionText,
    style: style,
    onVariantSelected: function(variant, $select) {
        var vat = variant.price * 1.2;
    jQuery(".my-vat span").html(theme.Currency.formatMoney(vat,theme.moneyFormat))
    }
0 Likes