CharlesEdition

luxury
automobiles

True-luxury is a rare
and refined experience.

ONE THAT’S FELT, NOT OWNED.

Don’t Drive Away Just Yet.

Get insider access to exclusive listings, premium offers, and first looks at new arrivals. Stay ahead in the fast lane of luxury.

By submitting your email, you agree to receive updates, exclusive offers, and curated listings from Charles Edition.

jQuery(document).ready(function ($) { const cookieKey = "wishlist_posts"; function getWishlist() { const cookie = document.cookie .split("; ") .find((row) => row.startsWith(cookieKey + "=")); return cookie ? JSON.parse(decodeURIComponent(cookie.split("=")[1])) : []; } function saveWishlist(wishlist) { const value = encodeURIComponent(JSON.stringify(wishlist)); document.cookie = `${cookieKey}=${value}; path=/; max-age=3600`; } function updateUI() { const wishlist = getWishlist(); $(".wishlist-toggle").each(function () { const postId = parseInt($(this).data("id")); $(this).toggleClass("active", wishlist.includes(postId)); }); $("#wishlist-counter, #wishlist-count").text(wishlist.length); } function updateShortlistLink() { const wishlist = getWishlist(); const $shortlistLink = $('#shortlist-link'); if ($shortlistLink.length && wishlist.length > 0) { const wishlistIds = wishlist.join(","); const url = `/shortlist/?wishlist_ids=${wishlistIds}`; $shortlistLink.attr('href', url); console.log("✅ SHORTLIST link updated to:", url); } } // Listen for icon clicks jQuery(document).on("click", ".wishlist-toggle", function () { const postId = parseInt($(this).data("id")); let wishlist = getWishlist(); const index = wishlist.indexOf(postId); if (index > -1) { wishlist.splice(index, 1); } else { wishlist.push(postId); } saveWishlist(wishlist); updateUI(); updateShortlistLink(); }); // Initial run updateUI(); updateShortlistLink(); // Redirect on shortlist page if no IDs if (document.body.classList.contains("elementor-page-3142")) { const wishlist = getWishlist(); const params = new URLSearchParams(window.location.search); if (!params.has("wishlist_ids") && wishlist.length > 0) { const newUrl = new URL(window.location.href); newUrl.searchParams.set("wishlist_ids", wishlist.join(",")); window.location.href = newUrl.toString(); } } });