Copied to clipboard

Flag this post as spam?

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


  • Peter S 64 posts 106 karma points
    Oct 09, 2017 @ 12:20
    Peter S
    0

    Main product with variants in basket, possible?

    Merchello 2.5 Umbraco 7.6.4

    We've got a Merchello store that has quite a few products in it. Some of these products have variants. For these products with variants, we need to be able to add the 'main' product to the basket, as well as the product's variants. Is this possible at all? The basket listing doesn't seem to work for the combination of 'main' and variants at the moment. It looks like when there are variants, you cannot add the 'main' product to the basket anymore. Is this correct?

  • Peter S 64 posts 106 karma points
    Oct 09, 2017 @ 13:20
    Peter S
    100

    Answering my own question.

    When you normally add a product to the basket, Merchello checks to see if the IProduct object has variants and then automatically selects the first one to add to the basket.

    So instead of adding an IProduct, add the product as a MasterVariantDisplay like so:

    basket.AddItem(product.AsMasterVariantDisplay(), product.Name, model.Quantity); 
    

    This allows you to add the 'main' product to the basket, while also being able to add it's variants.

Please Sign in or register to post replies

Write your reply to:

Draft