Recently, a client requested that their existing Cartthrob site now allow guest checkouts.

Currently it’s using a multi-page checkout. One page uses {exp:cartthrob:save_customer_info_form} and the next uses {exp:cartthrob:checkout_form}.

The problem lies on the first page. Previously I populated the form with the user’s details if they had it saved in their account, using Solspace User’s {exp:user:stats} tag. But now I need to support guest checkouts. The problem is that the {exp:user:stats} tag will hide its contents if the user is logged out.

So I basically repeat the code, but wrapped in the {exp:user:stats} tag if they are logged in. (This feels like the wrong way to do this, so if you have an alternative I’d love to hear it.)

{if logged_in}


  {exp:cartthrob:save_customer_info_form required="..." return="cart/payment"}   

   <input type="submit" class="button" value="Next Step" />




 {exp:cartthrob:save_customer_info_form required="..." return="cart/payment"}   

  <input type="submit" class="button" value="Next Step" />



Originally, the code was just what was inside the first conditional.

The form is displayed correctly for members and guests, but only members are able to proceed to the next page. When a guest hits submit, the page is just reloaded.

The Cartthrob setting “User must be logged in” is set to “no”, and I have set the appropriate member id for guest checkouts.

1 Answer 1


If you open up the CartThrob member settings you can assign customer fields to custom member fields. These values then pre-populate through the CT checkout process. For example, on a site I built recently the CT settings look like this:

CartThrob Screenshot

Then, within my {exp:cartthrob:checkout_form} tag I have code like this:

<input type="text" name="first_name" id="first_name" value="{customer_first_name}" />

If the user is logged out or their first_name member field has not been populated then the value is left blank, so there's no need to create separate views for guests and members.

  • I don't want to save the data they enter during checkout, I just want to use the data already saved to their profile. Do those settings allow that? Nov 23, 2012 at 13:05
  • Fields will be pre-populated with the data already in member's profiles, but CT will also update member profiles when people checkout. Is there any particular reason why you'd want to disable that? I'd have thought you'd always want the most recent data saved to user's profiles.
    – Dom Stubbs
    Nov 23, 2012 at 13:22
  • I guess thats fair enough. But if you are purchasing as a gift and use someone else's shipping address, maybe you wouldn't want to overwrite your own details. Nov 23, 2012 at 16:51
  • The CT member settings let you assign separate sets of member fields for customer details and shipping details, so that shouldn't be much of an issue. You could just use the customer fields to pre-populate the shipping fields. If the shipping fields aren't mapped to member fields their values won't be saved to the member's profile.
    – Dom Stubbs
    Nov 23, 2012 at 17:05
  • I agree using the {customer_...} CT variables is the way to go.
    – mjr
    Nov 26, 2012 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.