How LLC Owners Save on Taxes in 2026

Software Engineer Find more write-offs — search your profession or a specific deduction
Try:
Others Also Use These Strategies
Software Engineer IRC §162

GitHub, AWS, JetBrains & Developer Tool Subscriptions

GitHub Pro/Teams, JetBrains IDE, AWS/Azure/GCP cloud services, Postman, Docker, Figma, Linear, Notion, and other developer tools are fully deductible for self-employed software engineers.

Eligibility Requirements
  • Self-employed (1099/freelance) software engineer
  • Tools used for client projects or business development
  • Subscription fees paid during the tax year
Example Savings Scenario

A freelance developer paying $2,400/year in AWS costs, $700 for JetBrains, $480 for GitHub Teams, and $600 for Figma deducts $4,180 — saving $1,379 at 33%.

MERNA Strategy Notes

Cloud service costs (AWS, Azure, GCP) for client projects are fully deductible. Track usage by project for accurate allocation.

Common Mistake: W-2 employees cannot deduct unreimbursed work tools under current tax law.
Software Engineer IRC §179

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%.

MERNA Strategy Notes

If the computer is used for both personal and business use, only the business-use percentage is deductible. A dedicated work machine with no personal use is 100% deductible.

Common Mistake: W-2 employees cannot deduct unreimbursed hardware under current tax law. Mixed-use computers require a business-use percentage allocation.
Business IRC §280A Uncle Kam Clients Only

Bookkeeper Home Office & Vehicle Deduction

Bookkeepers working from home can deduct the home office space used exclusively for client work — typically worth $1,500–$4,000 per year using the actual expense method. Vehicle mileage to client offices, bank runs, and networking events is deductible at 70 cents per mile. A bookkeeper driving 5,000 business miles deducts $3,500.

Eligibility Requirements
  • Must use a dedicated space in your home exclusively and regularly for bookkeeping
  • Vehicle must be used for business purposes (client meetings, bank runs)
  • Must report income on Schedule C
  • Must have documentation of business use
Example Savings Scenario

A freelance bookkeeper using 12% of their home for bookkeeping deducts $2,400/year in home office expenses, plus $2,010 in vehicle mileage (3,000 miles x $0.67), saving $1,633 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 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
Retirement IRC §223 Uncle Kam Clients Only

HSA Triple Tax Advantage

Health Savings Accounts offer a triple tax advantage: contributions are tax-deductible, growth is tax-free, and withdrawals for qualified medical expenses are tax-free. The OBBBA also expanded HSA eligibility to include bronze and catastrophic plans starting 2026.

Eligibility Requirements
  • Enrolled in a High Deductible Health Plan (HDHP) or qualifying bronze/catastrophic plan (new for 2026)
  • Not enrolled in Medicare
  • Not claimed as a dependent on someone else's return
Example Savings Scenario

Contributing $8,750 (family) to an HSA in 2026 saves $3,237 in taxes at a 37% rate. Investing the balance for 20 years at 7% grows to $33,800+ tax-free.

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
Therapist IRC §280A Uncle Kam Clients Only

Home Office Deduction for Therapists

Therapists who maintain a dedicated space in their home used exclusively and regularly for client sessions or administrative work qualify for the home office deduction. You can deduct a proportional share of rent or mortgage interest, utilities, internet, and homeowners insurance based on the square footage of the therapy space relative to total home square footage.

Eligibility Requirements
  • Dedicated room used exclusively for therapy sessions or administrative work
  • Space used regularly (not occasionally)
  • Can be a home office for telehealth sessions or in-person sessions
  • Works for both renters and homeowners
Example Savings Scenario

A therapist with a 200 sq ft home office in a 1,500 sq ft home (13.3%) paying $2,500/month rent deducts $3,990/year. A homeowner with $18,000 in mortgage interest and utilities deducts $2,394/year.

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 §280A Uncle Kam Clients Only

Home Studio & Practice Space Deduction

Musicians who use a dedicated space at home for recording, practicing, or teaching can deduct a proportional share of rent or mortgage interest, utilities, internet, and home maintenance. Soundproofing, acoustic panels, and studio furniture are 100% deductible.

Eligibility Requirements
  • Dedicated space used regularly and exclusively for music business
  • Self-employed musician with Schedule C income
  • Space used for recording, practice, teaching, or administrative work
Example Savings Scenario

A musician with a 200 sq ft studio in a 1,500 sq ft home deducts 13.3% of $24,000 annual rent = $3,200/year, saving $1,120 at a 35% 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
Business IRC §280A Uncle Kam Clients Only

Virtual Assistant Home Office & Equipment Deduction

Virtual assistants working from home can deduct the home office space used exclusively for client work — typically $1,500–$4,000 per year. Also deduct computer equipment, monitors, keyboards, headsets, and any hardware used for client work under Section 179. A VA spending $3,000 on a new MacBook and monitor setup deducts the full amount in the year purchased.

Eligibility Requirements
  • Must be a self-employed virtual assistant
  • Must use a dedicated space in your home exclusively and regularly for VA work
  • Equipment must be used for VA work that generates income
  • Must report income on Schedule C
Example Savings Scenario

A virtual assistant using 10% of their home for work deducts $2,000/year in home office expenses, plus $1,500 in laptop and equipment, saving $1,295 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

Copywriter Home Office & Research Deduction

Copywriters working from home can deduct their dedicated home office space, all research materials (books, industry reports, subscriptions), and any databases or research tools used for client work. A copywriter spending $2,000 on industry research, competitor analysis tools, and reference materials deducts the full amount. Also deduct Grammarly, Hemingway, and writing software subscriptions.

Eligibility Requirements
  • Must be a self-employed copywriter or content writer
  • Must use a dedicated space in your home exclusively and regularly for writing
  • Research costs must be for copywriting work that generates income
  • Must report income on Schedule C
Example Savings Scenario

A freelance copywriter using 12% of their home for writing deducts $2,400/year in home office expenses, plus $1,200 in research and reference materials, saving $1,332 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

Business Consultant Home Office & Professional Setup Deduction

Business consultants working from home can deduct the home office space used exclusively for client work and business activities. A 300 sq ft office in a 2,500 sq ft home yields a 12% deduction of all home expenses — typically $4,000–$10,000 per year. Also deduct all office equipment, furniture, and technology used for consulting work under Section 179.

Eligibility Requirements
  • Must be a self-employed business or management consultant
  • Must use a dedicated space in your home exclusively and regularly for consulting
  • Equipment must be used for consulting work that generates income
  • Must report income on Schedule C
Example Savings Scenario

A business consultant using 15% of their home for consulting deducts $4,500/year in home office expenses, plus $3,000 in equipment, saving $2,775 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

Freelancer Home Office Deduction

Freelancers working from home can deduct the home office space used exclusively and regularly for business. The simplified method allows $5 per square foot (max 300 sq ft = $1,500 deduction). The actual expense method — deducting a percentage of rent, utilities, insurance, and internet — typically yields $3,000–$8,000 per year for most freelancers.

Eligibility Requirements
  • Must be a self-employed freelancer or independent contractor
  • Must use a dedicated space in your home exclusively and regularly for freelance work
  • Space must be your principal place of business
  • Must report income on Schedule C
Example Savings Scenario

A freelancer using 12% of their home for work deducts $2,400/year in home office expenses, saving $888 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

Attorney Home Office & Law Library Deduction

Attorneys working from home can deduct their home office space and all law library expenses: Westlaw ($3,000–$10,000/yr), LexisNexis ($2,000–$8,000/yr), Casetext ($1,200/yr), and physical law books. A solo attorney spending $5,000/year on legal research databases deducts the full amount. Also deduct practice management software (Clio, MyCase, PracticePanther).

Eligibility Requirements
  • Must be a self-employed attorney or solo practitioner
  • Must use a dedicated space in your home exclusively and regularly for law practice
  • Law library and research materials must be for legal work
  • Must report income on Schedule C
Example Savings Scenario

A solo attorney using 15% of their home for law practice deducts $4,500/year in home office expenses, plus $2,400 in Westlaw and legal research tools, saving $2,553 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

Graphic Designer Equipment & Home Office Deduction

Graphic designers can deduct computer equipment (iMac, MacBook Pro), external monitors, drawing tablets (Wacom Intuos Pro $500, Cintiq $1,500+), and any hardware used for design work under Section 179. A designer spending $5,000 on a new iMac and Wacom tablet deducts the full amount in year one. Also deduct the home office space used exclusively for design work.

Eligibility Requirements
  • Must be a self-employed graphic designer
  • Must use a dedicated space in your home exclusively and regularly for design work
  • Equipment must be used for design work that generates income
  • Must report income on Schedule C
Example Savings Scenario

A graphic designer using 12% of their home for design work deducts $2,400/year in home office expenses, plus $3,500 in equipment (iMac, Wacom tablet, monitor), saving $2,183 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
Home Health Care Business IRC §162, §132(d) Uncle Kam Clients Only

Caregiver Mileage & Vehicle Reimbursement

Home health care businesses incur significant vehicle costs — caregivers drive to client homes, supervisors conduct home visits, and owners travel to meetings and training. The 2026 IRS standard mileage rate is 70 cents per mile for business use. Agencies can reimburse caregivers for mileage through an accountable plan, making the reimbursement tax-free to the employee and fully deductible to the business. Alternatively, actual vehicle expenses (fuel, insurance, maintenance, depreciation) can be deducted based on business-use percentage.

Eligibility Requirements
  • Business miles driven to client homes
  • Supervisor home visit mileage
  • Training, licensing, and continuing education travel
  • Caregiver mileage reimbursements through accountable plan
  • Owner/operator vehicle used for business
Example Savings Scenario

A home health care agency owner driving 20,000 business miles per year deducts $14,000 at the 2026 rate of 70 cents per mile, saving $5,180 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
Musician IRC §162 Uncle Kam Clients Only

Touring & Travel Expense Deduction

Self-employed musicians can deduct 100% of transportation costs (flights, train, rental cars, mileage) and lodging for business travel to gigs, tours, recording sessions, and music conferences. Meals are 50% deductible while traveling away from home overnight.

Eligibility Requirements
  • Travel is for a bona fide business purpose (gig, recording, conference)
  • Away from home overnight (for lodging and meal deductions)
  • Self-employed musician with Schedule C income
Example Savings Scenario

A musician who spends $15,000 on touring (flights, hotels, van rental) and $4,000 on meals deducts $15,000 + $2,000 (50% meals) = $17,000, saving $5,950 at 35%.

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 §62(a)(2)(A), Reg. 1.62-2 Uncle Kam Clients Only

Accountable Plan Reimbursements

Establish a formal accountable plan to reimburse employees (including owner-employees) for business expenses tax-free. The business deducts the reimbursement; the employee pays no income or payroll tax on it.

Eligibility Requirements
  • Operate as an S-Corp, C-Corp, or partnership
  • Expenses have a business connection
  • Employee substantiates expenses and returns excess amounts
Example Savings Scenario

An S-Corp owner with $15,000 in home office, vehicle, and phone expenses reimburses through an accountable plan, saving $5,550 in combined income and payroll 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 §199A Uncle Kam Clients Only

QBI Deduction (20% Pass-Through Deduction) for Home Care Agencies

Home health care businesses structured as sole proprietorships, partnerships, LLCs, or S-Corps may qualify for the Qualified Business Income (QBI) deduction under IRC §199A — a 20% deduction on net business income. For a home care agency generating $200,000 in net profit, this deduction alone saves $14,800 in federal taxes. Home health care is generally NOT classified as a Specified Service Trade or Business (SSTB), which means the income limitation phase-out that applies to doctors and lawyers typically does not apply — making this deduction available at higher income levels.

Eligibility Requirements
  • Home health care agency structured as LLC, S-Corp, or sole proprietor
  • Taxable income below $197,300 (single) or $394,600 (married) — full deduction
  • Income above thresholds: W-2 wage limitation applies
  • Home health care is generally NOT an SSTB — no income cap for most agencies
Example Savings Scenario

A home health care agency owner with $250,000 in net business income takes a $50,000 QBI deduction, saving $18,500 in federal 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
Therapist IRC §401(k), §408(k) Uncle Kam Clients Only

Solo 401(k) and SEP-IRA for Therapists

Therapists in private practice can make tax-deductible retirement contributions that dramatically reduce taxable income. A Solo 401(k) allows contributions of up to $70,000/year ($77,500 if age 50+) in 2026 as both employee and employer. A SEP-IRA allows contributions of up to 20% of net self-employment income (max $70,000). Both reduce taxable income dollar-for-dollar and grow tax-deferred until retirement.

Eligibility Requirements
  • Self-employed therapist with net income from private practice
  • Solo 401(k): no full-time employees other than spouse
  • SEP-IRA: available even with part-time employees
  • Must open Solo 401(k) by December 31 to contribute for the current year
Example Savings Scenario

A therapist earning $100,000 net who contributes $30,000 to a Solo 401(k) reduces taxable income to $70,000, saving $8,400 in federal taxes at a 28% effective rate — plus the money grows tax-deferred.

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 §1362, §3121 Uncle Kam Clients Only

S-Corp Election for Musicians

Musicians earning $80,000+ in net self-employment income can elect S-Corp status to reduce self-employment (SE) tax. As an S-Corp owner, you pay SE tax only on your salary — not on distributions. This can save $10,000–$20,000/year at higher income levels.

Eligibility Requirements
  • Net self-employment income of $80,000+
  • Willing to pay yourself a reasonable salary
  • File Form 2553 to elect S-Corp status (deadline: March 15)
Example Savings Scenario

A musician with $150,000 net income pays $21,240 in SE tax as a sole proprietor. With an S-Corp and $70,000 salary, SE tax drops to $9,912 — saving $11,328/year.

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 §401(k), §408(k) Uncle Kam Clients Only

Solo 401(k) and SEP-IRA for Musicians

Self-employed musicians can make tax-deductible retirement contributions that dramatically reduce taxable income. A Solo 401(k) allows contributions of up to $70,000/year ($77,500 if age 50+) as both employee and employer. A SEP-IRA allows contributions of up to 20% of net self-employment income (max $70,000).

Eligibility Requirements
  • Self-employed musician with net income from music
  • Solo 401(k): no full-time employees other than spouse
  • SEP-IRA: available even with part-time employees
  • Must open Solo 401(k) by December 31 to contribute for the current year
Example Savings Scenario

A musician earning $80,000 net who contributes $20,000 to a Solo 401(k) reduces taxable income to $60,000, saving $7,000 in federal taxes 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
Musician IRC §162, §167 Uncle Kam Clients Only

Sync Licensing, Royalty Income & Music Publishing Deductions

Musicians who earn income from sync licensing (TV, film, commercials), streaming royalties (Spotify, Apple Music, YouTube), and music publishing can deduct all direct costs of generating that income. This includes music attorney fees for licensing negotiations, copyright registration fees ($65 per work), music distribution platform fees (DistroKid, TuneCore, CD Baby), PRO membership fees (ASCAP, BMI, SESAC), and any costs related to pitching music for sync placements.

Eligibility Requirements
  • Self-employed musician earning royalty or licensing income
  • Expenses directly related to generating the licensing/royalty income
  • Music attorney fees for licensing agreements
  • Distribution and PRO membership fees
Example Savings Scenario

A musician earning $30,000 in sync licensing who pays $3,000 in music attorney fees, $500 in copyright registrations, and $200 in distribution fees deducts $3,700, saving $1,295 at 35%.

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
Real Estate IRC §280A(g) Uncle Kam Clients Only

Augusta Rule (Home Rental Exclusion)

Rent your personal home to your business for up to 14 days per year. The rental income is tax-free to you personally, and the business deducts the full rental expense.

Eligibility Requirements
  • Own a business (S-Corp, LLC, or sole prop)
  • Home rented for 14 days or fewer per year
  • Rental rate must be comparable to local market rates
  • Document with a rental agreement and business purpose
Example Savings Scenario

Renting your home to your S-Corp for 14 days at $2,000/day = $28,000 tax-free income to you, $28,000 deduction for the business, saving $10,360 in combined 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
Retirement IRC §412 Uncle Kam Clients Only

Defined Benefit Pension Plan

A defined benefit plan allows high-income self-employed individuals and business owners to contribute $200,000–$300,000 per year based on actuarial calculations, far exceeding 401(k) limits.

Eligibility Requirements
  • Self-employed or small business owner
  • High income ($300,000+) for maximum benefit
  • Actuarial calculation required annually
  • Commitment to fund the plan each year
Example Savings Scenario

A physician earning $500,000 contributes $265,000 to a defined benefit plan, saving $98,050 in taxes at a 37% rate — far exceeding the $69,000 Solo 401(k) limit.

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 Software Engineers Don't Know

RSU vesting is ordinary income taxed at your highest marginal rate — selling shares immediately and reinvesting in a tax-advantaged account can save $15,000–$40,000/year.

A backdoor Roth IRA and mega backdoor Roth 401(k) together allow tech employees to shelter $83,500/year from taxes permanently — most never execute both.

An S-Corp election on consulting or side income can save software engineers $8,000–$20,000/year in self-employment taxes on income above their W-2 salary.

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 Software Engineers

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

What tax deductions can a software engineer claim?
Software engineers can deduct home office, computer equipment, software subscriptions, cloud services, technical books and courses, conference fees, internet, and phone (business %). Freelance engineers have additional deductions for all business expenses.
Can a software engineer deduct a home office?
Yes, if the space is used exclusively and regularly for work. Remote software engineers can deduct a proportional share of rent/mortgage, utilities, and internet. A 150 sq ft office in a 1,500 sq ft home = 10% of housing costs deductible.
Should a freelance software engineer form an S-Corp?
Yes \u2014 freelance engineers earning $80,000+ in net income typically save $8,000\u2013$25,000/year with an S-Corp election. You pay yourself a reasonable salary and take remaining income as distributions, avoiding SE tax on the distribution portion.
Can a software engineer deduct technical courses and certifications?
Yes \u2014 AWS certifications, Udemy courses, O'Reilly subscriptions, technical books, and conference fees (AWS re:Invent, Google I/O) are fully deductible as business expenses for self-employed engineers. W-2 engineers cannot deduct these at the federal level.
What is the R&D Tax Credit for software companies?
Software companies developing new or improved functionality can claim the R&D Tax Credit (Form 6765). Qualifying activities include designing algorithms, developing new software features, and testing. Startups can use up to $250,000 of the credit against payroll taxes.
0 of 76 write-offs saved

Your Biggest Missed Deduction Is Probably Locked Above

Uncle Kam clients save an average of $15,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_v1'; var bar = document.getElementById('ukwf-sticky-save-bar'); var countEl = document.getElementById('ukwf-sticky-save-count'); if (!bar || !countEl) return;function getSavedCount() { try { return (JSON.parse(localStorage.getItem(SAVED_KEY) || '[]')).length; } catch(e) { return 0; } }function updateBar() { var n = getSavedCount(); countEl.textContent = n; if (n > 0) { bar.classList.add('ukwf-sticky-save-bar--visible'); } else { bar.classList.remove('ukwf-sticky-save-bar--visible'); } }/* Update whenever localStorage changes (bookmark toggles fire a custom event) */ window.addEventListener('ukwfSavedChanged', updateBar); /* Also poll lightly for cross-tab changes */ window.addEventListener('storage', function(e) { if (e.key === SAVED_KEY) updateBar(); });/* Expose globally so autocomplete can trigger it */ window.ukwfStickyBarRefresh = updateBar; updateBar(); })();/* ── 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 saved = getSaved(); var idx = saved.findIndex(function(i) { return i.slug === slug; }); if (idx === -1) { saved.push({ slug: slug, name: name, category: cat, 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); }); })();