How do I pre-populate cart and checkout data?

This article will explain how to link customers to the checkout with pre-populated data, so that you can build shopping flows outside of Contractor Commerce, and send users directly into the checkout for Payment Processing.

In cases where customers provide information about their purchase prior to landing on the checkout page, you can use the following information to pre-populate checkout data so that users can have a faster and easier checkout.

The following URL parameters can be added to inbound links to pre-populate the Checkout with user data, or items.

  • firstname

  • lastname

  • email

  • phone

  • address

  • apt

  • city

  • state

  • zipcode

  • billing_firstname

  • billing_lastname

  • billing_address

  • billing_apt

  • billing_city

  • billing_state

  • billing_zipcode

  • items (array of objects with the following structure {sku, qty, type, frequency})

Example: https://demoshop.contractorcommerce.com/shop/ is the URL of the page containing the Contractor Commerce store plugin.

Any of the URL parameters can be added to the cart via a JSON formatted array, like:
https://demoshop.contractorcommerce.com/shop/#/checkout?firstname=andrew?items={"sku":X6670,"quantity":1,"type":product,"frequency":0}

HOWEVER, make sure you encode the URL characters so they are browser safe!
https://demoshop.contractorcommerce.com/shop/#/checkout?firstname=andrew&items=%5B%7B%22sku%22%3A%22X6675%22%2C%22qty%22%3A1%2C%22type%22%3A%22product%22%2C%22frequency%22%3A0%7D%5D