Display custom content / notice for specific variants

Highlighted
Excursionist
13 3 0

Is there a best practice for displaying certain information for specific variants?

For example some variants have a special shipping requirement. We only want to show that notice if specific variants are selected.

Here is how we currently plan to implement it but am curious if there is a better approach.

 

Use Variant Metafields to flag certain variants that require additional shipping notices.

Use the "selectCallback" javascript to show / hide certain info when the variant changes.

 

But as far as I can tell there is no way to read Variant Metafields via javascript?

So we would have to output our variant metafields as json or javascript variables with liquid and access them?

 

Or is there a better approach?

 

Thank you!

0 Likes