Add this code to your child theme functions.php file (you can read more about Child Themes here)
add_filter('vehica/widgets', function ($widgets) {
class CustomButtonSingleCarWidget extends \Vehica\Widgets\Car\Single\SingleCarWidget
{
const NAME = 'vehica_custom_button_single_car_widget';
/**
* @return string
*/
public function get_title()
{
return 'Custom Button (VIN)';
}
protected function render()
{
parent::render();
$car = $this->getCar();
if (!$car) {
return;
}
$field = vehicaApp('car_fields')->find(function ($field) {
/* @var \Vehica\Model\Post\Field\Field */
return $field->getId() === 6671;
});
if (!$field) {
return;
}
$value = $field->getValue($car);
if (empty($value)) {
return;
}
?>
<a class="vehica-button" href="https://anydomain.com/?vin=<?php echo esc_attr( $value); ?>">Button TEXT</a>
<?php
}
}
$widgets[\Vehica\Widgets\WidgetCategory::CAR_SINGLE][] = CustomButtonSingleCarWidget::class;
return $widgets;
});
Customize this code:
1. Custom Button (VIN) => Your name of a widget in the Elementor Sidebar
2. Button TEXT => Your Text on the button
3. 6671 => Text field ID (You can check text field ID, when you visit it via Vehica Panel in the URL e.g.
Add it to your single listing template
As you can see you will have a dynamic value in the URL