Skip to content

JS API

  • window.Convermax.getVehicle(); Return the selected vehicle.

    // Output example:
    { "Year": "2015", "Make": "Ford", "Model": "F-150" }
  • window.Convermax.setVehicle(); Add a car to the garage and select it. If the car is already in the garage, it will not be added twice.

    // Usage example:
    window.Convermax.setVehicle({ Year: '2015', Make: 'Ford', Model: 'F-150' });
  • window.Convermax.getVehicleList(); Return a list of selected vehicles.

    // Output example:
    [
    {
    Year: '2015',
    Make: 'Ford',
    Model: 'F-150',
    },
    {
    Year: '2016',
    Make: 'Ford',
    Model: 'F-150',
    },
    ];
  • window.Convermax.setVehicleList(); Set vehicle list as garage. The last vehicle will be selected automatically.

    // Usage example:
    window.Convermax.setVehicleList([
    {
    Year: '2015',
    Make: 'Ford',
    Model: 'F-150',
    },
    {
    Year: '2016',
    Make: 'Ford',
    Model: 'F-150',
    },
    ]);
  • window.Convermax.addVehicle(); Add a vehicle to the garage. The vehicle will not be selected automatically.

    // Usage example:
    window.Convermax.addVehicle({ Year: '2015', Make: 'Ford', Model: 'F-150' });
  • window.Convermax.removeVehicle();

    Remove a vehicle from the garage.

    // Usage example:
    window.Convermax.removeVehicle({ Year: '2015', Make: 'Ford', Model: 'F-150' });
  • window.Convermax.verifyFitmentAsync(); Async function to check product compatibility with vehicle.

    // Usage examples:
    // Calling the function on the product page without parameters
    // will check the compatibility of the current product and the currently selected vehicle.
    await window.Convermax.verifyFitmentAsync();
    // Calling the function on the product page with the passed vehicle
    // will check the compatibility of the current product and the passed car.
    await window.Convermax.verifyFitmentAsync({ Year: '2015', Make: 'Ford', Model: 'F-150' });
    // Calling the function with the passed product ID
    // will check the compatibility of the passed product and the currently selected vehicle.
    await window.Convermax.verifyFitmentAsync('3051');
    // Calling the function with the passed product ID and the passed vehicle
    // will check the compatibility of the passed product and the passed vehicle.
    await window.Convermax.verifyFitmentAsync('3051', { Year: '2015', Make: 'Ford', Model: 'F-150' });
    // Output examples:
    ('yes'); // The product and vehicle are compatible.
    ('no'); // The product and vehicle are not compatible.
    ('unknown'); // The product does not have fitment data.
    ('universal'); // The product is a universal fit.
  • window.Convermax.onVehicleSelected = (param) => expression; Subscribing to the vehicle selection event. The parameter is the selected machine.

    // Usage example:
    window.Convermax.onVehicleSelected = (vehicle) => console.log(vehicle);
    // Output example:
    { "Year": "2015", "Make": "Ford", "Model": "F-150" }
  • window.Convermax.onVehicleRemoved = (param) => expression; Subscribing to the vehicle removal event. The parameter is a vehicle list without a removed vehicle.

    // Usage example:
    window.Convermax.onVehicleRemoved = (newVehicleList) => console.log(newVehicleList);
    // Output example:
    [
    {
    Year: '2016',
    Make: 'Ford',
    Model: 'F-150',
    },
    ];