Use your implementation, but add if statements for specific products before it. Then, you can use a dynamic variable for the product/variant ID reference e.g. {{productVariant.id}}. Try different ways and pick the best one.
Example:
If you still need assistance, feel free to ask! Please check my answer as a solution if I helped you.
