Automating Product Linking for Prestige Theme using Flow

Hi,

I have to use the Prestige theme for an upcoming Shopify project due to its feature that allows linking separate product pages as if they were variants. Given the extensive catalog of the store, automation is key to efficiently leveraging this feature.

Conditions:
a) A custom product metafield referencing to multiple products (list of products) exists
b) When a product is added to the store, it comes with all SKU values of every single variant, fully populated
c) products that I need to link together share the same initial part of the sku.

Here’s the objective:

When adding a new product, I aim to link together all products sharing the same initial string within their SKU.

Since the theme needed the creation of a custom metafield for that purpose, the automation should use that metafield to reference (select) all products with matching initial string segments in the SKU.

Does anyone know if it’s possible to achieve this result using Flow?

Thank you!

Hi Fildec,

This is not achievable with Flow because Products or Variants cannot be queried by SKU or by SKU substring. Iterating through all Products to try and find matches is not feasibly at the moment because conditional checks only work on complete values, not substrings.

We’re continuing to work on building more functionality to unblock these use cases in Flow and work with teams across Shopify to provide more powerful APIs, so this may become feasible in the future.

Hope that helps

1 Like

Thank you for letting me know of the limitations @DaveMcV
I guess I’ll have to relay on third-party apps or try a different theme. Thanks.

Hey @DaveMcV

sorry for iterating on this again, but I was just wondering if it was possible to query products by tag using flow.
So, if I were to use the reference list of products metafield, I could reference all the products that share the same tag.

Thank you in advance!

Hey @Fildec ,

Yep! You can filter by tag by adding tag:YOURTAG to the query. It can’t do substring match, only full text match.

More information on the search syntax can be found in the Shopify API search syntax docs

Hey @DaveMcV ,

Thank you for your reply.

With the following setup, I can assign a list of products tagged for instance ‘color:yellow’ to a given product page.

Can the tag be a variable?
My logic would be:

  1. Add new product

  2. This product will have a tag whose value can be extracted with this script:

{{product.variants | map: “sku” | first | split: “-” | slice: 0, 2 | join: “-” | replace: “\n”, “” }}

  1. Once I have this value, I want to find all products tagged with this exact value:
    tag:derived_tag

  2. Assign these products to the product reference metafield.

So, to filter, I came up with this script:

{% assign derived_tag = product.variants | map: "sku" | first | split: "-" | slice: 0, 2 | join: "-" | replace: "\n", "" %}
`tag:derived_tag`

But it doesn’t work.

Any idea how/if this approach could work?

Thank you!

Hi @Fildec

Yep, that field supports Liquid but you’ll need to use Liquid interpolation. Also my tick’s were a force of habit trying to do inline code. Those are not necessary.

Try something like this:

{%- assign derived_tag = product.variants | map: "sku" | first | split: "-" | slice: 0, 2 | join: "-" | replace: "\n", "" -%}
tag:{{derived_tag}}

You can also try using the Log output action in your workflow to check what the output is, then use that as a filter in the admin product list to make sure it’s working as expected.

Hope that helps!

1 Like

Hey @DaveMcV

It works :tada:

Thank you so much!

Hey! Im trying to achieve kind of the same thing but Im stuck on the part writing to the metafield:

How would you write to this field since we cant get the object? :slightly_smiling_face:

We highly recommend our app Variant Robot:
https://admin.shopify.com/store/variant-robot-app

Variant Robot can automatically link your separately listed products that are perceived as separate variants, such as individually listed colors.

The app features automatic synchronization, ensuring newly added products are linked together seamlessly.

When activating the app for the first time, you only need to define a few settings. This allows the app to understand the association between your separately listed products.