February 15, 2024

Cross Sell

$row) {
$name = $row['crosssell_name'] ?? '';

if (!$name) {
continue;
}

$target = sanitize_title($name);

if (isset($used_targets[$target])) {
$target = $target . '-' . ($index + 1);
}

$used_targets[$target] = true;

$icon = $row['crosssell_icon'] ?? '';
$hover_icon = $row['crosssell_hover_icon'] ?? '';

// Fallback for the typo version, if the ACF field was created that way.
if (!$hover_icon && !empty($row['crossell_hover_icon'])) {
$hover_icon = $row['crossell_hover_icon'];
}

$items[] = [
'target' => $target,
'name' => $name,
'icon_url' => lsg_crosssell_image_url($icon, 'thumbnail'),
'hover_icon_url' => lsg_crosssell_image_url($hover_icon, 'thumbnail'),
'body_image' => $row['crosssell_body_image'] ?? '',
'body_title' => $row['crosssell_body_title'] ?? '',
'body_text' => $row['crosssell_body_text'] ?? '',
'button_text' => $row['crosssell_body_button_text'] ?? '',
'button_url' => $row['crosssell_body_button_url'] ?? '',
'crosssell_url' => $row['crosssell_url'] ?? '',
'card_text' => $row['crosssell_text'] ?? '',
];
}

if (empty($items)) {
return;
}
?>

$item) {
$is_active = $index === 0 ? ' is-active' : '';
$image_url = lsg_crosssell_image_url($item['body_image'], 'large');
$image_alt = lsg_crosssell_image_alt($item['body_image'], $item['body_title'] ?: $item['name']);
?>

$item) {
$is_active = $index === 0 ? ' is-active' : '';
?>

Categories


Chat Icon Hi, I’m Allie! How can I help you today? Open Icon