Copied to clipboard

Flag this post as spam?

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

  • Philip Hayton 85 posts 411 karma points
    Aug 29, 2021 @ 19:19
    Philip Hayton

    Variant Names

    Hi guys,

    How do you override the default naming convention for Variants when they are added to an order?

    At the moment they include the Parent Product's name, but for our use case it we'd prefer it to just be the variants name.



  • Matt Brailsford 3872 posts 20650 karma points MVP 9x c-trib
    Aug 30, 2021 @ 08:29
    Matt Brailsford

    Hi Phil,

    If you want to replace how Vendr extracts the product name you can replace the IUmbracoProductNameExtractor with your own implementation. You'll need to override the ExtractProductName(IPublishedContent content, IPublishedElement variantContent, string languageIsoCode) and have it retrieve / return the name you require.

    You can review the docs here for details on how you replace a Vendr implementation

    An alternative approach can also be adding a productName property to the order line as this will override any generated name, however this will require you to provide the product name for every order line, so this is generally the better option when you only need to override the odd name here and there, where as replacing the IUmbracoProductNameExtractor is the better option if you want to change how names are generated system wide.

  • Philip Hayton 85 posts 411 karma points
    Aug 30, 2021 @ 08:34
    Philip Hayton

    Excellent thank you, I'll have a play with both approaches to see which one fits best.

    Thanks again for the super swift response.


Please Sign in or register to post replies

Write your reply to: