Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Marcus Maunula 229 posts 386 karma points
    Jun 12, 2017 @ 18:21
    Marcus Maunula

    Getting Productinfo for Variants?

    I have a problem when trying to get ProductInfo when you have variants. They have a GUID and that does not seem to work when trying to get TypedContent.

    Is this a general problem or did I miss something?

       IPublishedContent productContent = Umbraco.TypedContent( orderLine.ProductIdentifier );

    This gives me null

  • Anders Burla Johansen 2560 posts 8256 karma points
    Jun 13, 2017 @ 09:51
    Anders Burla Johansen

    Hi Marcus

    That is because when using variants from the variant property editor with Tea Commerce - each variant have a GUID as the id and the product identifier will be the node id of Umbraco + "_" + variant GUID.

    Use the following code to get a ProductIdentifier object.

    using TeaCommerce.Umbraco.Configuration.Variants.Models;
    IPublishedContent productContent = Umbraco.TypedContent( new ProductIdentifier(orderLine.ProductIdentifier).NodeId );

    Kind regards


Please Sign in or register to post replies

Write your reply to: