Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.
This repository was archived by the owner on Jul 3, 2023. It is now read-only.

How can I push user e-mail to checkout? #602

Description

@Sterling-Malory-Archer

As stated in the title, I want to push the user's email into the checkout form when I open using .GetWebCheckoutLink.

I tried to use cartState.SetEmailAddress, but I am getting a null reference exception being thrown.

 public void AddItemToCart()
    {
        //Reset the cart because there's a bug with it not updating if the users open it when it's empty.
        cart.Reset();

        // Try to set the user e-mail in the checkout.
        cartState.SetEmailAddress(tMP_InputField.text,
            (error) =>
            {
            });

        //DefaultQueries.checkout.EmailUpdate(query, CurrentCheckout.id(), email);

        //For every cartItem in the List of CartItems, we add it to the cart after we reset it.
        foreach (var cartItem in cartItems)
        {
            cart.LineItems.AddOrUpdate(cartItem, 1);
        }
    }

Any help is kindly appreciated!

EDIT:
This is the error I am getting:

Screen Shot 2020-08-17 at 4 57 12 PM

And this is the line it's referring to (Where my horizontal cursor is):

Screen Shot 2020-08-17 at 4 57 28 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions