Skip to main content

E-commerce-Setup-Wizard

 

import React, { useState } from 'react'; // E-commerce Setup Wizard // Single-file React component (Tailwind CSS utility classes assumed available) // Features: // - Guided stepper for Shopify or WooCommerce store setup // - Store info form // - Product CSV generator (sample rows) for easy import // - Checklist export (JSON) and CSV download // - SEO meta generator // - App & theme recommendations // - Lightweight, client-only (works in CodeSandbox, Vite, CRA) export default function EcomSetupWizard() { const [platform, setPlatform] = useState('shopify'); const [step, setStep] = useState(1); const [store, setStore] = useState({ name: '', domain: '', locale: 'en-US', currency: 'USD', description: '' }); const [products, setProducts] = useState([ { title: 'Sample T-Shirt', sku: 'TSHIRT-001', price: '19.99', inventory: '100', tags: 'tshirt,fashion', description: 'Comfortable cotton tee', images: '' } ]); const [seo, setSeo] = useState({ title: '', meta: '', keywords: '' }); function addProduct(){ setProducts([...products, { title:'', sku:'', price:'0.00', inventory:'0', tags:'', description:'', images:'' }]); } function updateProduct(i, field, value){ const p = [...products]; p[i][field]=value; setProducts(p); } function removeProduct(i){ const p=[...products]; p.splice(i,1); setProducts(p); } function downloadCSV(){ // Generate a CSV formatted for both Shopify / WooCommerce basic imports const headers = ['Title','Body (HTML)','Vendor','Type','Tags','Published','Option1 Name','Option1 Value','Variant SKU','Variant Inventory Qty','Variant Price','Image Src']; const rows = products.map(p => [ escapeCsv(p.title), escapeCsv(p.description), '', '', escapeCsv(p.tags), 'TRUE', '', '', escapeCsv(p.sku), p.inventory, p.price, escapeCsv(p.images) ]); const csv = [headers, ...rows].map(r => r.join(',')).join('\n'); downloadFile(csv, `${store.name || 'products'}-import.csv`, 'text/csv'); } function downloadChecklist(){ const checklist = { platform, store, seo, products, steps: [ 'Create store account', 'Set domain & email', 'Add payment gateway (Stripe/PayPal/Local)', 'Set shipping zones & rates', 'Upload products (CSV)', 'Configure taxes', 'Install recommended apps', 'Test order flow and go live' ] }; downloadFile(JSON.stringify(checklist, null, 2), `${store.name || 'store'}-setup-checklist.json`, 'application/json'); } function generateSeo(){ const title = `${store.name} — ${store.description ? store.description.split('.')[0] : 'Online store'} `; const meta = `${title} | Buy now. Free shipping thresholds, secure checkout.`; const keywords = `${store.name}, ${store.domain}, online store, ${store.currency}`; setSeo({ title: title.substring(0,70), meta: meta.substring(0,160), keywords }); } function downloadFile(content, filename, mime){ const blob = new Blob([content], { type: mime }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; a.click(); URL.revokeObjectURL(url); } function escapeCsv(s){ if(s==null) return ''; return '"'+String(s).replace(/"/g,'""')+'"'; } const themeRecommendations = platform === 'shopify' ? [ { name:'Dawn', why:'Lightweight, flexible—good starting theme.' }, { name:'Minimal', why:'Clean storefront for small catalogs.' } ] : [ { name:'Storefront', why:'Well-supported for WooCommerce.' }, { name:'Astra', why:'Fast and versatile; pairs well with page builders.' } ]; const appRecommendations = platform === 'shopify' ? ['Oberlo (dropshipping)', 'Yotpo (reviews)', 'Klaviyo (email)'] : ['WooCommerce Subscriptions', 'MailPoet', 'WooCommerce Shipping']; return (

E-commerce Setup Wizard

Platform

Step {step} / 5

{step===1 && (
setStore({...store,name:e.target.value})} className="w-full p-2 rounded mt-1 bg-white/5" placeholder="e.g. My Cool Store" /> setStore({...store,domain:e.target.value})} className="w-full p-2 rounded mt-1 bg-white/5" placeholder="example.com" /> setStore({...store,currency:e.target.value})} className="w-32 p-2 rounded mt-1 bg-white/5" />