XY problem, ignoring code what is the GOAL you are trying to get to
https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
Are you not able to use metafield definitions, or product-tags, to put that “array” data directly on the product?
Split created arrays have no hash/key/value accessor method unlike how some native objects allow i.e:
{{ all_products['product-handle-string'].url }}
{%- assign varstring = "product-handle-string" -%}
{{ all_products[varstring ].url }}
trying to match the product name (using current_variant.sku) to the array name
Do you mean you are trying to match variant title to a variable name?
There’s no eval feature in liquid to convert a string to an assigned variable name.
You’d have to manually parse the string in an {%if%} or a {%case%} statement matching the string to then trigger using that variable name.
I think the closest hack is using liquid includes with the filenames as variables holding that string.
am looping through the values of current_variant.sku
The sku is a singular value do you mean you are looping over all the variants in a product?
Otherwise there’s only 1 current_variant at a time per product if you are referring to product.selected_variant https://shopify.dev/api/liquid/objects/product#product-selected_variant .
If you have the current_variant, you should already have access to the containing product object and not have to use a sku to figure out what the product is.
You may want to reread this a few times and re-approach the problem statement for clarity or make a better simplified example.