Add a car make and model dropdown to Shopify

Ask for the vehicle on your contact form or on a product page, with the field names Shopify keeps.

Shopify works well with the picker once you know its one rule: it only keeps form fields whose names follow its pattern. That's why this page has two blocks, one for each place a shop usually asks about a car, with the names Shopify expects already filled in.

Pick the one that matches your shop:

  • You take bookings or quote requests (a detailer, a garage, a tyre fitter): the vehicle goes on your contact form, and arrives in the contact email.
  • You sell a service or product per vehicle: the vehicle goes on the product page, and travels with the item into the cart and the order.

What you get

A make select, a model select that fills when someone picks a make, and a year select, from the official vehicle registers behind the VehiclesDB dataset. Cars by default; motorcycles, vans and trucks are an option.

On your contact form

Shopify's developer documentation says extra contact form fields "need to have an attribute of" name="contact[...]", and that their titles appear in your contact notifications. This block names its fields contact[Make], contact[Model] and contact[Year]:

Paste where the vehicle fields go

<label for="vehicle-make">Make</label>
<select id="vehicle-make" name="contact[Make]"></select>

<label for="vehicle-model">Model</label>
<select id="vehicle-model" name="contact[Model]"></select>

<label for="vehicle-year">Year</label>
<select id="vehicle-year" name="contact[Year]"></select>

<script src="https://cdn.jsdelivr.net/npm/make-model-dropdown@0.4.1"></script>
<script>
  VehiclesDropdown.attach({
    make: "#vehicle-make",
    model: "#vehicle-model",
    year: "#vehicle-year",
    kind: "car",
    order: "popular",
    includeOther: true,
    otherLabel: "Other / not listed",
    placeholderMake: "Make",
    placeholderModel: "Model",
    placeholderYear: "Year",
    source: "dataset"
  })
</script>

This block works as it is, with no key and no account: it reads the open dataset and shows a small credit line under the picker, which free use requires. Paid plans can remove the credit line.

Want another language, vehicle kind or country? Choose your options and copy your own block. A free key adds make logos and puts the most registered makes at the top of the list.

  1. Open your theme's code (Shopify's help on editing theme code). Shopify's own advice: edit theme code only if you know HTML and CSS and have a basic understanding of Liquid. If you don't, send this page to whoever does.
  2. Find your contact form: in the theme's code it starts with {% form 'contact' %}.
  3. Paste the block inside the form, before the submit button, and save.
  4. Your contact notifications now include Make, Model and Year.

On a product page

Shopify calls these line item properties: fields inside the product form whose names look like properties[...]. Shopify's developer documentation says property inputs need to be included inside the product form. This block names its fields properties[Make], properties[Model] and properties[Year]:

Paste where the vehicle fields go

<label for="vehicle-make">Make</label>
<select id="vehicle-make" name="properties[Make]"></select>

<label for="vehicle-model">Model</label>
<select id="vehicle-model" name="properties[Model]"></select>

<label for="vehicle-year">Year</label>
<select id="vehicle-year" name="properties[Year]"></select>

<script src="https://cdn.jsdelivr.net/npm/make-model-dropdown@0.4.1"></script>
<script>
  VehiclesDropdown.attach({
    make: "#vehicle-make",
    model: "#vehicle-model",
    year: "#vehicle-year",
    kind: "car",
    order: "popular",
    includeOther: true,
    otherLabel: "Other / not listed",
    placeholderMake: "Make",
    placeholderModel: "Model",
    placeholderYear: "Year",
    source: "dataset"
  })
</script>

This block works as it is, with no key and no account: it reads the open dataset and shows a small credit line under the picker, which free use requires. Paid plans can remove the credit line.

Want another language, vehicle kind or country? Choose your options and copy your own block. A free key adds make logos and puts the most registered makes at the top of the list.

  1. Open your theme's code, as above.
  2. Find the product form in your product template or section (it's the form that holds the add to cart button).
  3. Paste the block inside that form, before the add to cart button, and save.
  4. The make, model and year now travel with the item into the cart and the order.

Check that it works

  1. Open your store in a private window.
  2. Pick a make, a model and a year, then send the contact form to yourself, or add the product to the cart and place a test order.
  3. Look for Make, Model and Year in the contact notification or on the order. Values arrive as short lowercase names, such as volkswagen, golf and 2019.

The picker is done when that test arrives with the vehicle in it, not when the lists appear.

Common problems

  • The vehicle is missing from the email or order. The block sits outside the form. Move it inside {% form 'contact' %} or the product form.
  • You used the block from another page of our site. Those name their fields make, model and year, which Shopify doesn't keep. Use the blocks on this page.
  • You can't edit the theme's code. Shopify lets you edit a theme's code once you've purchased the theme.
  • Nothing loads, and the browser console mentions a Content Security Policy. Your site sends a policy that blocks scripts from other sites. Allow https://cdn.jsdelivr.net for scripts and connections, and https://vehiclesdb.com for connections if your block has a key.
  • You use a block with a key. A key only works on the websites it is locked to. Keys made on the embed page are locked to your site and also work on your own computer (localhost) for testing. To test on a staging or preview address, add it to the key's websites in Settings first.

Every other guide is on the make and model dropdown page.

Questions people ask

Why do the field names matter on Shopify?

Shopify's contact form sends fields named contact[…], and a product form attaches fields named properties[…] to the order line. A field with any other name doesn't reach you, so the blocks on this page come with those names already set.

Do I need to edit my theme's code?

Yes, because the picker has to sit inside the form, and the form lives in your theme's code. Shopify lets you edit a theme's code once you've purchased the theme (a paid theme on trial has to be bought first).

Is this a parts fitment filter?

No. It asks which vehicle the customer has, for a booking, a quote or an order note. It doesn't filter your products by what fits a vehicle; we don't publish parts fitment data.

Can I use a Custom Liquid section instead?

Only to show the picker. Shopify says a Custom Liquid section, if your theme offers one, can hold code without editing the theme. But a section outside your form doesn't send anything with it, so the vehicle wouldn't reach you.