How LLC Owners Save on Taxes in 2026

Business Owner Find more write-offs — search your profession or a specific deduction
Try:
Others Also Use These Strategies
Business IRC §179

Section 179 Expensing

Immediately expense the full cost of qualifying business equipment, software, and certain vehicles in the year of purchase instead of depreciating over multiple years.

Eligibility Requirements
  • Business equipment, machinery, or software
  • Property placed in service during the tax year
  • Business income must be sufficient (cannot create a loss with §179)
Example Savings Scenario

Purchasing $500,000 in equipment. Full §179 deduction saves $185,000 in taxes at a 37% rate in Year 1 vs. spreading over 5–7 years.

MERNA Strategy Notes

Combine with bonus depreciation for any amount above the §179 limit. Heavy SUVs are capped at $30,500 under §179 but can use bonus depreciation for the remainder.

Common Mistake: Section 179 cannot create a net operating loss — bonus depreciation can.
UNK Client Win Medical/Dental Practice Owner

How a Miami Dentist Wrote Off $185,000 in Equipment in Year One

A UNK client opened a new dental practice and purchased $185,000 in dental chairs, X-ray equipment, and computer systems. Instead of depreciating the equipment over 5–7 years, Uncle Kam applied Section 179 to expense the full $185,000 in Year 1. At the client's 37% marginal rate, this generated $68,450 in immediate tax savings — essentially the IRS subsidizing 37% of his equipment purchase.

Result: $68,450 in Year 1 tax savings. The client used the tax savings to fund his first Solo 401(k) contribution, building retirement wealth while reducing his tax bill further.

Buying equipment, vehicles, or technology for your business? Section 179 could let you write it all off in Year 1. Book a call to plan your purchase timing.

Be the Next Win — Book a Call
Common Questions About Section 179 Expensing
Business IRC §162, §179 Uncle Kam Clients Only

Vehicle & Mileage Deduction

Deduct business vehicle expenses using the standard mileage rate or actual expenses (depreciation, gas, insurance, repairs). Section 179 and 100% bonus depreciation allow full expensing of heavy SUVs and trucks in Year 1.

Eligibility Requirements
  • Vehicle used for business purposes
  • Mileage log maintained for standard rate method
  • Heavy SUV (6,000+ lbs GVWR) for Section 179 bonus
Example Savings Scenario

Driving 20,000 business miles at 72.5¢/mile = $14,500 deduction. A $80,000 SUV over 6,000 lbs can be fully expensed under 100% bonus depreciation, saving $29,600 at 37%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 / IRC §179 Uncle Kam Clients Only

Camera Gear & Production Equipment Deduction

Photographers, videographers, and content creators can deduct the full cost of cameras, lenses, tripods, lighting equipment, microphones, audio recorders, drones, gimbals, memory cards, hard drives, and any other production equipment used in their business. Under Section 179, the full cost can be expensed in Year 1 instead of depreciated over 5 years.

Eligibility Requirements
  • Equipment used for business photography, video, or content creation
  • Self-employed photographer, videographer, or content creator
  • Business use percentage must be documented for mixed-use equipment
Example Savings Scenario

A photographer purchasing a $3,500 camera body and $1,200 in lenses expenses the full $4,700 under Section 179, saving $1,410–$1,880 in taxes.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 Uncle Kam Clients Only

Internet & Broadband Deduction

Your home internet bill is deductible to the extent it is used for business. For most self-employed professionals who work from home, this is 50–100% of the monthly cost. A dedicated business internet line is 100% deductible.

Eligibility Requirements
  • Self-employed, freelancer, or business owner
  • Internet used for business purposes
  • Allocate business vs personal use if mixed
Example Savings Scenario

A self-employed consultant paying $80/month for internet and using it 80% for business deducts $768/year, saving $230–$307 in taxes.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 / IRC §179 Uncle Kam Clients Only

Computer, Laptop & Hardware Deduction

Computers, laptops, tablets, monitors, keyboards, mice, external hard drives, and other hardware used in your business are fully deductible. Under Section 179, you can expense the full cost in Year 1 instead of depreciating over 5 years. For mixed business/personal use, only the business-use percentage is deductible.

Eligibility Requirements
  • Computer or hardware used for business purposes
  • Self-employed, freelancer, or business owner
  • Business-use percentage documented for mixed-use devices
Example Savings Scenario

A freelance software engineer purchasing a $2,500 laptop used 95% for work expenses $2,375 under Section 179, saving $713–$950 in taxes.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 Uncle Kam Clients Only

Software & Subscription Deduction

Any software subscription or SaaS tool you pay for and use in your business is fully deductible in the year paid. This includes accounting software (QuickBooks, FreshBooks), design tools (Adobe Creative Cloud, Figma, Canva), communication tools (Zoom, Slack, Microsoft 365), project management tools (Asana, Monday.com), and any other business application.

Eligibility Requirements
  • Software used for business purposes
  • Self-employed, freelancer, or business owner
  • Annual or monthly subscription fees qualify
Example Savings Scenario

A freelance designer paying $600/year for Adobe Creative Cloud, $150 for Figma, and $200 for project management tools deducts $950/year, saving $285–$380.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Musician IRC §179, §168(k) Uncle Kam Clients Only

Musical Instruments & Equipment Deduction

Self-employed musicians can deduct the full cost of instruments, amplifiers, microphones, PA systems, recording equipment, and other music gear used for business. Section 179 and bonus depreciation allow 100% first-year write-off.

Eligibility Requirements
  • Self-employed musician with Schedule C income
  • Equipment used for business performances, recording, or teaching
  • Purchased and placed in service during the tax year
Example Savings Scenario

A musician who buys a $5,000 guitar, $3,000 amp, and $8,000 recording interface deducts $16,000 in Year 1, saving $5,600 at a 35% effective rate.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Dentist IRC §179 Uncle Kam Clients Only

Dental Equipment & Operatory Build-Out — Section 179

Dental chairs, X-ray machines, CBCT scanners, intraoral cameras, autoclaves, and operatory build-outs are 100% deductible under Section 179. A $200,000 equipment purchase saves $66,000+ in taxes at the 33% bracket.

Eligibility Requirements
  • Own or operate a dental practice
  • Equipment placed in service during the tax year
  • Used exclusively for dental practice
Example Savings Scenario

Dr. Chen purchases a new CBCT scanner ($85,000) and two dental chairs ($40,000) — full $125,000 deducted in Year 1, saving $41,250 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Pharmacist IRC §179 Uncle Kam Clients Only

Pharmacy Dispensing Equipment & Automation Systems

Automated dispensing systems (Parata, ScriptPro), pill counters, compounding equipment, refrigeration units, and pharmacy management software are fully deductible under Section 179 for independent pharmacy owners.

Eligibility Requirements
  • Own or operate an independent pharmacy
  • Equipment placed in service during the tax year
  • Used exclusively for pharmacy operations
Example Savings Scenario

An independent pharmacy owner purchasing a Parata dispensing robot ($120,000) deducts the full amount in Year 1 — saving $39,600 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Chiropractor IRC §179 Uncle Kam Clients Only

Chiropractic Tables, Adjustment Equipment & Therapy Devices

Chiropractic adjustment tables, drop tables, flexion-distraction tables, decompression equipment, ultrasound therapy units, electrical stimulation devices, and cold laser therapy equipment are fully deductible under Section 179.

Eligibility Requirements
  • Own or operate a chiropractic practice
  • Equipment placed in service during the tax year
  • Used exclusively for patient care
Example Savings Scenario

Dr. Johnson purchases 3 adjustment tables ($45,000), a decompression table ($28,000), and therapy devices ($22,000) — full $95,000 deducted in Year 1, saving $31,350 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Chiropractor IRC §179 Uncle Kam Clients Only

Chiropractic X-Ray Equipment & Digital Imaging Systems

Digital X-ray systems, full-spine X-ray units, and posture analysis software are major capital expenses for chiropractors — and fully deductible under Section 179.

Eligibility Requirements
  • Own or operate a chiropractic practice
  • X-ray equipment placed in service during the tax year
  • Used exclusively for patient diagnosis
Example Savings Scenario

Dr. Kim purchases a digital X-ray system for $55,000 — full $55,000 deducted in Year 1, saving $18,150 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Veterinarian IRC §179 Uncle Kam Clients Only

Veterinary Equipment — Ultrasound, Surgical Suite & Diagnostics

Veterinary ultrasound machines, digital X-ray systems, surgical suites, anesthesia equipment, dental units, endoscopes, and diagnostic analyzers are fully deductible under Section 179.

Eligibility Requirements
  • Own or operate a veterinary practice
  • Equipment placed in service during the tax year
  • Used exclusively for veterinary care
Example Savings Scenario

Dr. Thompson purchases an ultrasound ($45,000), digital X-ray ($55,000), and surgical suite equipment ($80,000) — full $180,000 deducted in Year 1, saving $59,400 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 Uncle Kam Clients Only

Office Supplies & Materials Deduction

Any supplies you purchase and use in your business are fully deductible in the year purchased. This includes paper, pens, printer ink and toner, folders, binders, postage, envelopes, labels, staples, tape, and any other consumable materials used in your work.

Eligibility Requirements
  • Self-employed, freelancer, or business owner
  • Supplies used for business purposes
  • Consumed or used up within the tax year
Example Savings Scenario

A small business owner spending $1,200/year on office supplies saves $360–$480 in taxes depending on their bracket.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 Uncle Kam Clients Only

Coworking Space & Office Rent Deduction

If you rent a coworking space, shared office, or dedicated office for your business, the full cost is deductible. This includes WeWork, Regus, local coworking memberships, and any other office rental. Monthly membership fees, day passes, and dedicated desk or private office costs all qualify.

Eligibility Requirements
  • Coworking space or office used for business purposes
  • Self-employed, freelancer, or business owner
  • Monthly or annual fees paid for the space
Example Savings Scenario

A freelancer paying $400/month for a coworking membership deducts $4,800/year, saving $1,440–$1,920 in taxes.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Crypto IRC §162 / §179 Uncle Kam Clients Only

Crypto Mining Equipment & Electricity

If you mine cryptocurrency, your mining hardware (ASICs, GPUs, mining rigs) and the electricity used to power them are fully deductible business expenses. Section 179 allows you to expense the full cost of equipment in the year of purchase rather than depreciating it over time.

Eligibility Requirements
  • Active cryptocurrency miner
  • Mining as a business (not hobby)
  • Hardware used exclusively for mining
Example Savings Scenario

A miner who spends $15,000 on ASICs and $8,000/year on electricity saves $5,750 in taxes at a 25% effective rate — plus Section 179 allows full first-year expensing of the hardware.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Airbnb Host IRC §179 Uncle Kam Clients Only

Airbnb Furnishings, Appliances & Guest Amenities — Section 179

Furniture, appliances, bedding, towels, smart TVs, hot tubs, and guest amenities for a short-term rental are fully deductible under Section 179 as personal property.

Eligibility Requirements
  • Short-term rental host
  • Furnishings used exclusively for the rental property
  • Items placed in service during the tax year
Example Savings Scenario

A new Airbnb host furnishing a 3-bedroom property with furniture ($18,000), appliances ($8,000), bedding ($3,000), and smart TVs ($2,000) deducts $31,000 in Year 1 — saving $10,230 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Software Engineer IRC §179 Uncle Kam Clients Only

MacBook Pro, Monitors & Developer Hardware — Section 179

MacBook Pro, custom PC builds, multiple monitors, mechanical keyboards, ergonomic chairs, and other hardware used for software development are fully deductible under Section 179 for self-employed engineers.

Eligibility Requirements
  • Self-employed (1099/freelance) software engineer
  • Hardware used exclusively or primarily for business
  • Equipment placed in service during the tax year
Example Savings Scenario

A freelance developer buying a MacBook Pro M3 Max ($3,999), two 4K monitors ($1,200), and a mechanical keyboard ($200) deducts $5,399 — saving $1,782 at 33%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business Expenses IRC §162 / IRC §280A Uncle Kam Clients Only

Studio Space & Creative Workspace Deduction

If you rent a separate studio space for your creative work, the full cost of rent, utilities, and equipment for that space is deductible. If you use a dedicated room in your home exclusively as a studio, it qualifies for the home office deduction. This applies to photography studios, podcast recording studios, video production spaces, and any other dedicated creative workspace.

Eligibility Requirements
  • Dedicated space used exclusively for business creative work
  • Rented studio: full cost deductible; home studio: home office deduction rules apply
  • Self-employed creative professional
Example Savings Scenario

A photographer renting a studio for $1,500/month deducts $18,000/year in rent, saving $5,400–$7,200 in taxes.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Home Health Care Business IRC §162, §179 Uncle Kam Clients Only

Medical Supplies, PPE & Clinical Equipment

All medical supplies and personal protective equipment (PPE) used in providing home health care services are fully deductible: disposable gloves, masks, gowns, face shields, hand sanitizer, wound care supplies, blood pressure cuffs, pulse oximeters, glucometers, thermometers, stethoscopes, and other clinical equipment. Larger equipment (hospital beds, wheelchairs, Hoyer lifts, CPAP machines) qualifies for Section 179 immediate expensing if owned by the agency. Uniforms, scrubs, and non-adaptable work clothing are also deductible.

Eligibility Requirements
  • Disposable PPE (gloves, masks, gowns)
  • Clinical equipment (BP cuffs, pulse oximeters, glucometers)
  • Wound care and medical supplies
  • Uniforms, scrubs, and work clothing
  • Durable medical equipment owned by the agency
Example Savings Scenario

A home health care agency spending $18,000/year on PPE, supplies, and clinical equipment saves $6,660 in taxes at 37%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Equipment IRC §179 Uncle Kam Clients Only

YouTuber Channel Equipment & Production Deduction

YouTubers can deduct all camera equipment, lighting, microphones, tripods, and production gear used for their channel. A Sony A7 IV ($3,500), Rode microphone ($400), and Elgato lighting kit ($200) are all deductible under Section 179 in the year purchased. Equipment used for both personal and business use must be allocated by business-use percentage.

Eligibility Requirements
  • Must create YouTube content that generates income (AdSense, sponsorships, memberships)
  • Equipment must be used for YouTube content creation
  • Must use equipment more than 50% for business purposes
  • Can deduct full cost in year of purchase under Section 179
Example Savings Scenario

A YouTuber buying a $3,200 Sony camera, $1,500 lens, $600 microphone, $800 lighting kit, and $400 in accessories deducts the full $6,500 in year one, saving $2,405 at 37%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
Business IRC §280A Uncle Kam Clients Only

Photographer Studio & Home Office Deduction

Photographers can deduct a dedicated home studio space used exclusively for photography work — shooting, editing, and client meetings. A 400 sq ft studio in a 2,000 sq ft home yields a 20% deduction of all home expenses — typically $4,000–$10,000 per year. Also deduct editing software (Adobe Lightroom, Photoshop, Capture One), cloud storage, and gallery delivery platforms (Pixieset, ShootProof).

Eligibility Requirements
  • Must be a self-employed photographer
  • Studio must be used exclusively and regularly for photography business
  • Home studio qualifies if used exclusively for photography sessions or editing
  • Must report income on Schedule C
Example Savings Scenario

A photographer using 20% of their home as a studio deducts $5,000/year in home studio expenses, saving $1,850 at 37%.

Unlock the Full Strategy Breakdown — Free

Enter your email for instant access to MERNA strategy notes, IRS red flag warnings, action steps, and implementation guide.

No spam · No obligation · Instant access
What Most Business Owners Don't Know

The Augusta Rule is the most underused strategy for business owners who own their home.

An accountable plan can move $15,000–$30,000 of personal expenses into tax-free business reimbursements.

S-Corp salary optimization alone saves most owners $15,000–$40,000/year in payroll taxes.

Who Uses This Strategy

This write-off is commonly used by the following taxpayer profiles. Click to see all strategies for your situation.

Common Questions for Business Owners

Get answers to the most frequently asked tax questions for your profession.

What tax write-offs can a business owner claim?
Business owners can deduct payroll, rent, equipment (Section 179), vehicle expenses, business meals (50%), marketing, professional services, retirement plan contributions, health insurance, and home office. Most business owners miss $20,000\u2013$80,000 in deductions.
What is the Section 199A QBI deduction for business owners?
The QBI deduction allows pass-through business owners (LLCs, S-Corps, sole proprietors) to deduct up to 20% of qualified business income. On $200,000 of business income, this saves $8,800\u2013$14,800 in federal taxes.
Should a business owner elect S-Corp status?
Yes, for most business owners earning $60,000+ in net profit. An S-Corp election saves $5,000\u2013$30,000/year in self-employment taxes by allowing you to split income between salary and distributions.
Can a business owner deduct vehicle expenses?
Yes. Either the standard mileage rate (70 cents/mile in 2026) or actual expenses (gas, insurance, depreciation). For a vehicle used 80% for business with $15,000 annual costs, the deduction is $12,000.
How can a business owner maximize retirement contributions to reduce taxes?
A Solo 401(k) allows up to $70,000/year. A SEP-IRA allows 20% of net income (max $70,000). A defined benefit plan can allow $100,000\u2013$300,000+/year for older, high-income business owners.
0
0 write-offs saved
Tap to view your list

Your Biggest Missed Deduction Is Probably Locked Above

Uncle Kam clients save an average of $25,000–$120,000/year. The strategies that make that possible are unlocked on a free strategy call.

Book A Free Strategy Call Free consultation. No obligation.
';// ── Open in a new window and print ─────────────────────────────── var win = window.open('', '_blank', 'width=850,height=700,scrollbars=yes,noopener=0'); if (!win) { // Fallback: inject an iframe for printing if popup is blocked var iframe = document.createElement('iframe'); iframe.style.cssText = 'position:fixed;top:-9999px;left:-9999px;width:850px;height:700px;border:0;'; document.body.appendChild(iframe); iframe.contentDocument.open(); iframe.contentDocument.write(html); iframe.contentDocument.close(); setTimeout(function() { iframe.contentWindow.focus(); iframe.contentWindow.print(); setTimeout(function() { document.body.removeChild(iframe); }, 2000); }, 600); return; } win.document.open(); win.document.write(html); win.document.close(); win.focus(); setTimeout(function() { win.print(); }, 600); }// ── Email Unlock: post to GHL silently, expand locked cards ────────────── function ukwfUnlockStrategies(e) { e.preventDefault(); // Support both the main wall form AND per-card gate forms var form = e ? e.target : null; var gateInput = form ? form.querySelector('.ukwf-gate-email-input') : null; var mainInput = document.getElementById('ukwf-unlock-email'); var emailInput = (gateInput && gateInput.value.trim()) ? gateInput : mainInput; var errorEl = document.getElementById('ukwf-unlock-error'); var email = emailInput ? emailInput.value.trim() : ''; // Also check the gate input if main is empty if (!email && gateInput) email = gateInput.value.trim(); // Basic email validation if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { if (errorEl) errorEl.style.display = 'block'; if (gateInput) { gateInput.style.borderColor = '#ff6b6b'; gateInput.focus(); } else if (emailInput) emailInput.focus(); return; } if (errorEl) errorEl.style.display = 'none'; if (gateInput) gateInput.style.borderColor = ''; // Disable all unlock buttons document.querySelectorAll('.ukwf-email-unlock-btn, .ukwf-gate-email-btn').forEach(function(b) { b.disabled = true; b.textContent = 'Unlocking...'; }); // Send lead to GHL via server-side PHP AJAX (bypasses webhook workflow) var professionEl = document.querySelector('.ukwf-profile-name'); var professionName = professionEl ? professionEl.textContent.trim().replace(/\s*Tax Write-Offs\s*&?\s*Deductions\s*$/i, '').trim() : ''; var nameParts = professionName.split('/'); var ghlFirstName = nameParts[0] ? nameParts[0].trim() : professionName; var ghlLastName = nameParts[1] ? nameParts[1].trim() : 'Tax Write-Off Finder'; var ajaxUrl = (typeof ukwfConfig !== 'undefined' && ukwfConfig.ajaxUrl) ? ukwfConfig.ajaxUrl : '/wp-admin/admin-ajax.php'; var nonce = (typeof ukwfConfig !== 'undefined' && ukwfConfig.leadNonce) ? ukwfConfig.leadNonce : ''; var formData = new FormData(); formData.append('action', 'ukwf_ghl_lead'); formData.append('nonce', nonce); formData.append('email', email); formData.append('firstName', ghlFirstName); formData.append('lastName', ghlLastName); formData.append('profession', professionName); formData.append('source', 'ukwf-unlock'); formData.append('page', window.location.pathname); fetch(ajaxUrl, { method: 'POST', body: formData }).catch(function() {}); // fire-and-forget // Expand all locked cards immediately ukwfDoUnlock(); } function ukwfDoUnlock() { // Hide the email wall var wall = document.getElementById('ukwf-email-unlock-wall'); if (wall) { wall.style.transition = 'opacity 0.3s ease'; wall.style.opacity = '0'; setTimeout(function() { wall.style.display = 'none'; }, 300); } // Unlock all locked cards instantly — no stagger (stagger caused 4+ second delay for 70+ cards) var lockedCards = document.querySelectorAll('.ukwf-result-card--locked'); lockedCards.forEach(function(card) { // Remove locked state — keep collapsed so user can open each card individually card.classList.remove('ukwf-result-card--locked'); card.classList.add('ukwf-result-card--open'); // Clear any inline styles that might block the toggle var body = card.querySelector('.ukwf-result-body'); if (body) { body.style.display = ''; body.style.maxHeight = ''; } // Remove lock badge var badge = card.querySelector('.ukwf-result-lock-badge'); if (badge) badge.style.display = 'none'; // Replace the locked gate with an unlocked badge var gate = card.querySelector('.ukwf-locked-strategy-gate'); if (gate) { gate.innerHTML = '
Unlocked — tap to expand
'; } }); // Show success banner var banner = document.getElementById('ukwf-unlock-banner'); if (banner) { banner.style.display = 'flex'; } // Persist unlock in localStorage so it survives refresh, tab close, and navigation // Uses the same ukwfSetUnlocked() that the book-call path uses, which sets // localStorage key 'ukwf_unlocked' = '1'. The main script block already checks // ukwfIsUnlocked() on page load and calls ukwfUnlockAll() automatically. if (typeof ukwfSetUnlocked === 'function') { ukwfSetUnlocked(); } else { try { localStorage.setItem('ukwf_unlocked', '1'); } catch(err) {} } // Also run the main unlock function to handle any card variants we might miss if (typeof ukwfUnlockAll === 'function') { ukwfUnlockAll(); } } // NOTE: Auto-unlock on page load is handled by the main script block which // checks ukwfIsUnlocked() and calls ukwfUnlockAll(). No DOMContentLoaded // listener needed here (it was broken anyway because LiteSpeed defers scripts // past DOMContentLoaded)./* ── Sticky Save Bar ───────────────────────────────────────────────── */ (function() { var SAVED_KEY = 'ukwf_saved_v2'; var bar = document.getElementById('ukwf-sticky-save-bar'); var countEl = document.getElementById('ukwf-sticky-save-count'); var badgeEl = document.getElementById('ukwf-sticky-cart-badge'); var savingsWrap = document.getElementById('ukwf-sticky-save-savings'); var savingsRange = document.getElementById('ukwf-sticky-savings-range'); if (!bar || !countEl) return;var _prevCount = 0;/* Parse a savings string like "$1,200–$4,500/year" -> {min, max} */ function parseSavings(str) { if (!str) return null; var nums = str.replace(/[^0-9]/g, ' ').trim().split(/\s+/).filter(Boolean); var vals = nums.map(function(n) { return parseInt(n, 10); }).filter(function(n) { return !isNaN(n) && n > 0; }); if (vals.length === 0) return null; if (vals.length === 1) return { min: vals[0], max: vals[0] }; return { min: Math.min.apply(null, vals), max: Math.max.apply(null, vals) }; }/* Format a number as $XK or $X.XM */ function fmtMoney(n) { if (n >= 1000000) return '$' + (n / 1000000).toFixed(1).replace(/\.0$/, '') + 'M'; if (n >= 1000) return '$' + Math.round(n / 1000) + 'K'; return '$' + n.toLocaleString(); }/* Animated count-up for a single element */ function animateCount(el, from, to, duration) { if (from === to) { el.textContent = to; return; } var start = null; function step(ts) { if (!start) start = ts; var progress = Math.min((ts - start) / duration, 1); var ease = 1 - Math.pow(1 - progress, 3); el.textContent = Math.round(from + (to - from) * ease); if (progress < 1) requestAnimationFrame(step); else el.textContent = to; } requestAnimationFrame(step); }function getSaved() { try { return JSON.parse(localStorage.getItem(SAVED_KEY) || '[]'); } catch(e) { return []; } }function updateBar() { var saved = getSaved(); var n = saved.length;/* Count-up animation when count changes */ if (n !== _prevCount) { animateCount(countEl, _prevCount, n, 600); if (badgeEl) animateCount(badgeEl, _prevCount, n, 600); /* Pop animation on bar when count increases */ if (n > _prevCount) { bar.classList.remove('ukwf-sticky-bar-pop'); void bar.offsetWidth; bar.classList.add('ukwf-sticky-bar-pop'); } _prevCount = n; }if (n > 0) { bar.classList.add('ukwf-sticky-save-bar--visible');/* Calculate total savings range */ var totalMin = 0, totalMax = 0, hasSavings = false; saved.forEach(function(item) { var p = parseSavings(item.savings || ''); if (p) { totalMin += p.min; totalMax += p.max; hasSavings = true; } });if (hasSavings && savingsWrap && savingsRange) { var rangeStr = totalMin === totalMax ? fmtMoney(totalMin) : fmtMoney(totalMin) + '–' + fmtMoney(totalMax); savingsRange.textContent = rangeStr; savingsWrap.style.display = ''; } else if (savingsWrap) { savingsWrap.style.display = 'none'; } } else { bar.classList.remove('ukwf-sticky-save-bar--visible'); if (savingsWrap) savingsWrap.style.display = 'none'; } }/* Update whenever a save/unsave happens */ window.addEventListener('ukwfSavedChanged', updateBar); /* Cross-tab sync */ window.addEventListener('storage', function(e) { if (e.key === SAVED_KEY) updateBar(); }); /* Expose globally */ window.ukwfStickyBarRefresh = updateBar; updateBar(); })();/* ── CART DRAWER ────────────────────────────────────────────────────── */ (function() { var SAVED_KEY = 'ukwf_saved_v2'; var drawer = document.getElementById('ukwf-cart-drawer'); var overlay = document.getElementById('ukwf-cart-overlay'); var itemsList = document.getElementById('ukwf-cart-items'); var emptyEl = document.getElementById('ukwf-cart-empty'); var footerEl = document.getElementById('ukwf-cart-footer'); var savingsStrip = document.getElementById('ukwf-cart-savings-strip'); var savingsAmount = document.getElementById('ukwf-cart-savings-amount'); var headerSub = document.getElementById('ukwf-cart-header-sub'); var footerCount = document.getElementById('ukwf-cart-footer-count'); if (!drawer) return;function getSaved() { try { return JSON.parse(localStorage.getItem(SAVED_KEY) || '[]'); } catch(e) { return []; } } function setSaved(arr) { localStorage.setItem(SAVED_KEY, JSON.stringify(arr)); window.dispatchEvent(new CustomEvent('ukwfSavedChanged')); if (typeof window.ukwfStickyBarRefresh === 'function') window.ukwfStickyBarRefresh(); if (typeof window.ukwfSavedBadgeRefresh === 'function') window.ukwfSavedBadgeRefresh(); } function parseSavings(str) { if (!str) return null; var nums = str.replace(/[^0-9]/g, ' ').trim().split(/\s+/).filter(Boolean); var vals = nums.map(function(n){ return parseInt(n,10); }).filter(function(n){ return !isNaN(n) && n > 0; }); if (!vals.length) return null; if (vals.length === 1) return { min: vals[0], max: vals[0] }; return { min: Math.min.apply(null,vals), max: Math.max.apply(null,vals) }; } function fmtMoney(n) { if (n >= 1000000) return '$' + (n/1000000).toFixed(1).replace(/\.0$/,'') + 'M'; if (n >= 1000) return '$' + Math.round(n/1000) + 'K'; return '$' + n.toLocaleString(); } function getCatIcon(cat) { var icons = { 'vehicle':'', 'home':'', 'travel':'', 'equipment':'', 'health':'', 'retirement':'', 'education':'', 'real estate':'' }; var k = (cat || '').toLowerCase(); for (var key in icons) { if (k.indexOf(key) !== -1) return icons[key]; } return ''; } function renderItems() { var saved = getSaved(); var n = saved.length; /* Update header sub */ if (headerSub) headerSub.textContent = n + ' deduction' + (n !== 1 ? 's' : '') + ' saved'; /* Show/hide empty state */ if (emptyEl) emptyEl.style.display = n === 0 ? '' : 'none'; if (footerEl) footerEl.style.display = n === 0 ? 'none' : ''; /* Savings strip */ var totalMin = 0, totalMax = 0, hasSavings = false; saved.forEach(function(item) { var p = parseSavings(item.savings || ''); if (p) { totalMin += p.min; totalMax += p.max; hasSavings = true; } }); if (hasSavings && savingsStrip) { savingsStrip.style.display = ''; var rangeStr = totalMin === totalMax ? fmtMoney(totalMin) : fmtMoney(totalMin) + ' – ' + fmtMoney(totalMax); if (savingsAmount) savingsAmount.textContent = rangeStr; } else if (savingsStrip) { savingsStrip.style.display = 'none'; } /* Footer count */ if (footerCount) footerCount.textContent = n > 0 ? n + ' write-off' + (n !== 1 ? 's' : '') + ' in your list' : ''; /* Remove existing items (keep empty state) */ var existing = itemsList ? itemsList.querySelectorAll('.ukwf-cart-item') : []; existing.forEach(function(el) { el.parentNode.removeChild(el); }); /* Render each item */ saved.forEach(function(item, idx) { var div = document.createElement('div'); div.className = 'ukwf-cart-item'; div.style.animationDelay = (idx * 0.04) + 's'; div.innerHTML = '
' + getCatIcon(item.category) + '
' + '
' + '
' + escHtml(item.name || item.slug) + '
' + (item.category ? '
' + escHtml(item.category) + '
' : '') + (item.savings ? '
' + escHtml(item.savings) + '/yr
' : '') + '
' + ''; /* Remove button handler */ div.querySelector('.ukwf-cart-item-remove').addEventListener('click', function() { var slug = this.getAttribute('data-slug'); var arr = getSaved().filter(function(i){ return i.slug !== slug; }); setSaved(arr); /* Animate out */ div.style.transition = 'opacity 0.18s, transform 0.18s'; div.style.opacity = '0'; div.style.transform = 'translateX(20px)'; setTimeout(function() { renderItems(); }, 180); /* Also update save buttons on page */ document.querySelectorAll('.ukwf-card-save-btn[data-slug="' + slug + '"]').forEach(function(btn) { btn.classList.remove('ukwf-card-save-btn--saved'); btn.setAttribute('aria-pressed','false'); var lbl = btn.querySelector('.ukwf-card-save-label'); if (lbl) lbl.textContent = 'Save'; }); }); if (itemsList) itemsList.appendChild(div); }); } function escHtml(s) { return String(s).replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"'); } function escAttr(s) { return String(s).replace(/"/g,'"').replace(/'/g,'''); } /* Open / close */ window.ukwfCartDrawerOpen = function() { renderItems(); if (drawer) drawer.classList.add('ukwf-cart-drawer--open'); if (overlay) overlay.classList.add('ukwf-cart-overlay--open'); document.body.style.overflow = 'hidden'; }; window.ukwfCartDrawerClose = function() { if (drawer) drawer.classList.remove('ukwf-cart-drawer--open'); if (overlay) overlay.classList.remove('ukwf-cart-overlay--open'); document.body.style.overflow = ''; }; window.ukwfCartClearAll = function() { if (!confirm('Remove all saved write-offs?')) return; setSaved([]); renderItems(); }; /* Keyboard close */ document.addEventListener('keydown', function(e) { if (e.key === 'Escape' && drawer && drawer.classList.contains('ukwf-cart-drawer--open')) { window.ukwfCartDrawerClose(); } }); /* Re-render when saves change */ window.addEventListener('ukwfSavedChanged', function() { if (drawer && drawer.classList.contains('ukwf-cart-drawer--open')) { renderItems(); } }); window.addEventListener('storage', function(e) { if (e.key === SAVED_KEY && drawer && drawer.classList.contains('ukwf-cart-drawer--open')) { renderItems(); } }); })();/* ── CARD SAVE BUTTONS ──────────────────────────────────────────────── */ (function() { var SAVED_KEY = 'ukwf_saved_v2';function getSaved() { try { return JSON.parse(localStorage.getItem(SAVED_KEY) || '[]'); } catch(e) { return []; } } function setSaved(arr) { localStorage.setItem(SAVED_KEY, JSON.stringify(arr)); } function isSaved(slug) { return getSaved().some(function(i) { return i.slug === slug; }); } function updateBtn(btn) { var slug = btn.getAttribute('data-slug'); var saved = isSaved(slug); btn.classList.toggle('ukwf-card-save-btn--saved', saved); btn.setAttribute('aria-pressed', saved ? 'true' : 'false'); var label = btn.querySelector('.ukwf-card-save-label'); if (label) label.textContent = saved ? 'Saved' : 'Save'; } function initAllBtns() { document.querySelectorAll('.ukwf-card-save-btn').forEach(function(btn) { updateBtn(btn); btn.addEventListener('click', function(e) { e.stopPropagation(); var slug = btn.getAttribute('data-slug'); var name = btn.getAttribute('data-name'); var cat = btn.getAttribute('data-category') || ''; var savings = btn.getAttribute('data-savings') || ''; var saved = getSaved(); var idx = saved.findIndex(function(i) { return i.slug === slug; }); if (idx === -1) { saved.push({ slug: slug, name: name, category: cat, savings: savings, savedAt: Date.now() }); } else { saved.splice(idx, 1); } setSaved(saved); updateBtn(btn); /* Sync badge and sticky bar */ window.dispatchEvent(new CustomEvent('ukwfSavedChanged')); if (typeof window.ukwfSavedBadgeRefresh === 'function') window.ukwfSavedBadgeRefresh(); if (typeof window.ukwfStickyBarRefresh === 'function') window.ukwfStickyBarRefresh(); }); }); } /* Init on load and re-sync on saved changes from autocomplete */ if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initAllBtns); } else { initAllBtns(); } window.addEventListener('ukwfSavedChanged', function() { document.querySelectorAll('.ukwf-card-save-btn').forEach(updateBtn); }); })();