Choosing a selection results in a full page refresh.
Opens in a new window.
🌹
Charly 🌹
Your Personal Florist
/**
* CHARLY CHATBOT - ALL-IN-ONE VERSION (NO SERVER REQUIRED)
*
* Instructions:
* 1. Go to Shopify Admin > Online Store > Themes
* 2. Click "..." next to your theme > Edit Code
* 3. Open "theme.liquid" or a new snippet
* 4. Paste this entire script before the
tag
*/
(function() {
'use strict';
// ========== THE KNOWLEDGE BASE (Everything is here!) ==========
const KnowledgeBase = {
store: {
name: 'Charmily Petals',
contact: 'info@charmilypetals.com',
instagram: '@charmily.petals',
location: 'Toronto, GTA'
},
// Core policies
policies: {
refunds: "All sales are final. Due to the perishable nature of flowers, we don't offer refunds once an order is fulfilled.",
delivery: "We deliver across the GTA! Same-day delivery is available if you order before 11am (weekdays) or 10am (weekends).",
pickup: "Free pickup is available! Just select it at checkout.",
timing: "Standard orders take 3-4 days to process, but we always try to be faster!"
},
// Common questions
faqs: {
"how long": "Our fresh roses usually last 7-10 days with proper care (cool spot, fresh water!).",
"custom": "We love custom orders! The best way is to DM us on Instagram @charmily.petals.",
"where": "We are based in Toronto and serve the entire Greater Toronto Area.",
"price": "Our bouquets start at $150. Some of our bestsellers are Je T'adior ($155) and Message in a Bouquet ($215)."
},
// Product list
products: [
{ name: "Message in a Bouquet", price: "$215" },
{ name: "Je T'adior", price: "$155" },
{ name: "Date Night", price: "$150" },
{ name: "Élysées Hydrangeas", price: "$180" },
{ name: "Angel's Kiss", price: "$160" }
]
};
// ========== THE BRAIN (Logic) ==========
const CharlyBrain = {
getResponse(userInput) {
const input = userInput.toLowerCase();
// 1. Check for Greetings
if (input.includes("hi") || input.includes("hello") || input.includes("hey")) {
return "Hi there! 🌹 I'm Charly. I know everything about our bouquets and policies. What can I help you with today?";
}
// 2. Check Policies
if (input.includes("refund") || input.includes("return")) return KnowledgeBase.policies.refunds;
if (input.includes("delivery") || input.includes("shipping")) return KnowledgeBase.policies.delivery;
if (input.includes("pickup")) return KnowledgeBase.policies.pickup;
if (input.includes("how long") || input.includes("time")) return KnowledgeBase.policies.timing;
// 3. Check FAQs
for (let key in KnowledgeBase.faqs) {
if (input.includes(key)) return KnowledgeBase.faqs[key];
}
// 4. Check Products
if (input.includes("product") || input.includes("bouquet") || input.includes("flower")) {
let pList = KnowledgeBase.products.map(p => p.name + " (" + p.price + ")").join(", ");
return "We have some beautiful options! Our bestsellers include: " + pList + ". Would you like to see more details on any of these?";
}
// 5. Check Contact
if (input.includes("contact") || input.includes("instagram") || input.includes("email")) {
return "You can email us at " + KnowledgeBase.store.contact + " or DM us on Instagram " + KnowledgeBase.store.instagram + " for a fast response!";
}
// Default Fallback
return "I'm not quite sure about that, but I'm still learning! 🌹 You can ask me about our delivery, refund policy, or our best-selling bouquets.";
}
};
// ========== THE INTERFACE (Attaching to your existing chat) ==========
// This part detects when you type in your current chat and provides the answer
function initCharly() {
console.log("Charly's Knowledge Base is active! 🌹");
// We hook into your existing 'Charly' variable if it exists
if (window.Charly) {
const originalGetResponse = window.Charly.getResponse;
window.Charly.getResponse = function(msg) {
const smartAnswer = CharlyBrain.getResponse(msg);
// If our smart brain has a specific answer, use it!
if (smartAnswer && !smartAnswer.includes("not quite sure")) {
return { text: smartAnswer, quickReplies: ['See bouquets', 'Delivery info'] };
}
// Otherwise, fall back to the original logic
return originalGetResponse.call(window.Charly, msg);
};
}
}
// Run when page is ready
if (document.readyState === 'complete') {
initCharly();
} else {
window.addEventListener('load', initCharly);
}
})();