DEV Community

UseCOS Research & Engineering
UseCOS Research & Engineering

Posted on Originally published at usecos.app

Why We Built a Zero-Iframe WordPress Calculator Plugin in Vanilla JS

Most WordPress calculator plugins fall into one of two traps: they either load heavy third-party <iframe> embeds (hurting Core Web Vitals and leaking visitor inputs to remote servers) or bundle megabytes of React/jQuery just to compute a monthly payment.

When we built UseCOS Canadian Calculators & Tools for WordPress.org, we enforced three strict engineering constraints:

  • Zero third-party scripts, fonts, or iframes: Everything executes locally in the visitor’s browser using plain Vanilla JS.
  • Zero data leaves the browser: Salaries, mortgage rates, GST totals, and VINs are never posted to an external API.
  • Exact Canadian statutory math: Fixed-rate Canadian mortgages compound semi-annually under Interest Act s. 6 (not US monthly compounding), CMHC tiers apply under $1.5M, and GST/HST/PST/QST rules cover all 13 provinces and territories.

Shortcode Architecture ([usecos_suite])

Instead of shipping separate bloated plugins for mortgage brokers, realtors, auto bloggers, and accounting sites, one lightweight shortcode bundle exposes five modular calculators:

  • [usecos_suite] — tabbed multi-tool card (subset via tools="mortgage,gst")
  • [usecos_mortgage] — Canadian semi-annual mortgage, CMHC premium, and OSFI B-20 stress test
  • [usecos_paycheck] — federal + provincial take-home pay, CPP/QPP, EI/QPIP, Ontario surtax & health premium
  • [usecos_gst] — add or reverse-extract GST/HST/PST/QST across all 13 jurisdictions
  • [usecos_auto] — auto loan payment + trade-in sales tax credit
  • [usecos_vin] — 17-character ISO 3779 check-digit validator and manufacturer/year decoder

Conditional Asset Enqueueing

A common WordPress performance mistake is enqueuing plugin CSS and JS on every single page load. In our plugin, scripts and styles only register when the active post content contains a usecos_* shortcode—keeping non-calculator pages at 0 KB overhead.

Links & Live Previews

Top comments (0)