Was wondering if it was possible to add specific Open Graph metadata (og:url, og:type, og:image, etc.) at a variant level with our current catalogue structure.
We want the variant Image (the right color) to be displayed when the URL is shared.
Variants are accessible via a unique query parameter added to each "Master product".
A "Variant" is a combination of a Color & Size for a specific Style. As such:
We are using Commerce 13.3
Any help would be much appreciated. Thanks!
Yes, thats very possible. In your product controller, you can load the variant by the variant code in the query string when it is present.
There is a good code example of loading a products variants in the ProductController of the Foundation code base:
Check out this class: Foundation/CatalogEntryViewModelFactory.cs at develop · episerver/Foundation · GitHub
Once you load the variant you have access any properties associated with it including images if you wish to store them there.
Thank you for your help Johnny!