Copied to clipboard

Flag this post as spam?

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


  • Daniel Nielsen 17 posts 102 karma points notactivated
    Sep 06, 2022 @ 13:29
    Daniel Nielsen
    0

    productSnapshot is null when adding to cart

    Hi.

    I have a problem when i i'm trying to add variant to my cart. I'm getting a null reference for productSnapshot.

    The document type for my products is Product Page and for my Variants is Product Variant.

    None of my props is undefined or null. I have a store.Id and both ProductReference and productVariantReference have data.

    What i'm i doing wrong?

    enter image description here

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 06, 2022 @ 15:32
    Matt Brailsford
    0

    Hey Daniel,

    What are productReference and productVariantReference set to? These should normally be Guids as strings and then the default product adapter should be able to resolve those.

    Also, have you changed the product adapter at all?

    Also, how are your variants setup? Using the variants prop editor? and is the variants property on the doc type set with the alias "variants"?

    Matt

  • Daniel Nielsen 17 posts 102 karma points notactivated
    Sep 07, 2022 @ 07:37
    Daniel Nielsen
    0

    Hi Matt.

    My problem was that my variant was not a Guid but just its Id. That fixed my problem.

    Thanks for fast reply.

    Best regards Daniel

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 07, 2022 @ 07:41
    Matt Brailsford
    0

    Perfect 👍

Please Sign in or register to post replies

Write your reply to:

Draft