Pre-Populate Custom Checkout Fields for Returning Clients

newbienewbie Member
Hey Foxy team,

We are wondering if it was possible to pre-populate custom checkout fields for clients who are logging in and modifying their subscriptions. The desire is to have the custom checkout fields pre-populated with the selections that the client made last time, so they don't have to choose them again.

If someone could show us how to accomplish that, we'd appreciate it!

Thanks so much!

Here's an example of some of the custom checkout information we're trying to pre-load for our clients...

<div class="fc-form-group ">
<div class="col-md-8 col-md-offset-3" data-fc-error-for="pickupDay" data-fc-error-class="fc-alert-container--error">
<div class="fc-input-group-container fc-input-group-container--checkbox fc-input-group-container--active">
<label style="font-weight:800" class="fc-input-group-container__title fc-input-group-container__title--forced fc-form-label">
Pick-up Day? (required)
</label>
<div class="fc-form-group">
<select name="Pickup Day" id="pickupDay" class="fc-form-control" aria-required="true" data-fc-required>
<option value="" selected="selected">Select a Pickup Day (required)</option>
<option value="Tues 8am" {% if pickupDay == "Tues 8am" %}selected{% endif %}>Tues 8am</option>
<option value="Thurs 8am" {% if pickupDay == "Thurs 8am" %}selected{% endif %}>Thurs 8am</option>
</select>
<textarea name="Pickup_Notes" id="Pickup_Notes" aria-required="false" autocomplete="off" class="fc-form-control" placeholder="If you prefer to designate a different area for pickup & delivery, please let us know here." style="background:#fff; height:5em;">{{ Pickup_Notes }}</textarea>
</div>
</div>
</div>
</div>
<br>


Comments
  • fc_adamfc_adam FoxyCart Team
    @newbie,

    Great question. We don't currently expose custom fields or attributes on the checkout when a customer logs in. It's also worth noting that custom checkout fields are currently linked to the transaction, rather than to the customer directly.

    A custom set up could be created, but it would require performing some custom coding. You would need to set up an endpoint on your server which communicates with the API to fetch the customers previous transactions and detect what they previously set for those custom fields. You would send off a request to that endpoint securely from the checkout after the customer logs in to fetch the values and set them on the checkout.

    Alternatively, if you had SSO set up, you could require the customer log in on your website first. When proceeding to the checkout, use the SSO endpoint as a way to fetch the customers previous values for those custom fields and set them as a hidden session variable for the transaction. Then within the code for your custom checkout fields you could check for those hidden session attributes to use as the default value for those fields.

    Both of those approaches could definitely work, but would require some custom development to get going. Sorry we didn't have a better answer, let us know if we can clarify any further.
  • Thanks @fc_adam!
Sign In or Register to comment.