I am doing a script in jQuery where it will create a sku_values for the variant items. I've managed to create an array for the items require in my sku.
[78,79,80]
- item value for the first variant
[81,82]
- item value for the 2nd
so what i want to do is create a concatenate value for these arrays
var variant_items = [];
if ($("input[name*='variant']").length > 0) {
$("input[name*='variant']").each(function(index, variant){
variant_items[index] = [];
var data = $(variant).data();
if($('ul[data-variant-id='+data.variantId+'] li').length > 0){
$('ul[data-variant-id='+data.variantId+'] li').each(function(i, item){
variant_items[index].push($(item).data('item-id'));
});
}
});
}
my expected output is
78_81
78_82
79_81
79_82
80_81
80_82
which is hard for me to solve the problem.