Calculators · Gutenberg
Profit Margin Calculator block for WordPress
Calculate profit margin, markup, selling price and gross profit for any product or service.
Get Blockenberg
Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.
What it actually does
Calculate profit margin, markup, selling price and gross profit for any product or service.
Inspector panels on this block: Calculator Settings, Display Options, Sizing. Those titles come from index.js, not from a shared template.
Behavior controls: “Default Mode” options: Margin % (Cost → Price), Markup % (Cost → Price), Revenue (Revenue + Cost).
Where to find it
Gutenberg inserter → Calculators → search “Profit Margin Calculator” (block name `blockenberg/margin-calculator` in block.json). Style it in the sidebar after insert.
How to use Profit Margin Calculator block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “Profit Margin Calculator”, insert it. Category: Calculators.
- Configure inspector controls that exist on this block. Open Calculator Settings. Set “Default Mode”, “Currency Symbol”, “Default Cost ($)”, “Default Margin / Markup (%)”.
- Check the published page. The view script reads HTML data attributes: data-key, data-mode, data-opts. The block editor preview may not run the same view script.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| Default Mode | Select control; the chosen value is saved on the block. Options: Margin % (Cost → Price); Markup % (Cost → Price); Revenue (Revenue + Cost). block.json default: margin. Saved as `defaultMode`. |
| Currency Symbol | Text field in the inspector. block.json default: $. Saved as `currency`. |
| Default Cost ($) | Text field in the inspector. block.json default: 50. Saved as `defaultCost`. |
| Default Margin / Markup (%) | Text field in the inspector. block.json default: 40. Saved as `defaultMargin`. |
| Default Revenue ($) | Text field in the inspector. block.json default: 100. Saved as `defaultRevenue`. |
| Show Breakdown Bar | On/off toggle in the inspector. On by default. Saved as `showBar`. |
| Show Markup % | On/off toggle in the inspector. On by default. Saved as `showMarkup`. |
| Show Margin Health Scale | On/off toggle in the inspector. On by default. Saved as `showMarginScale`. |
| Max Width (px) | Numeric range control in the inspector. Range 400–1200. block.json default: 680. Saved as `contentMaxWidth`. |
What the front-end script actually does
- The view script reads HTML data attributes: data-key, data-mode, data-opts.
- JavaScript functions that perform the math: calcMarginMode, calcMarkupMode, calcRevenueMode.
When this is the right block
- Calculate profit margin, markup, selling price and gross profit for any product or service — that is the job of Profit Margin Calculator, not a generic content block.
- Use it when you need the editor control labeled “Default Mode”, which exists on this block’s inspector.
- It matches pages about margin, profit, markup.
- The math runs in the visitor’s browser after publish — no extra calculator plugin.
Notes from the implementation
viewScript: this folder’s frontend.js is enqueued on the front end for this block.
FAQ
How do I add the Profit Margin Calculator block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Profit Margin Calculator”. It sits under Calculators. After insert, open Calculator Settings and set “Default Mode”, “Currency Symbol”, “Default Cost ($)”, “Default Margin / Markup (%)”.
Does Profit Margin Calculator need a server or extra plugin?
No. After Blockenberg is active, the view script runs in the browser with the values you saved on the block.
Is the Profit Margin Calculator Gutenberg block free?
Yes. Profit Margin Calculator ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style Profit Margin Calculator to match my theme?
Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Calculator Settings, Display Options, Sizing).
Related calculators blocks
Break-Even Calculator
Calculate break-even point, profit zone, and contribution margin for business analysis.
Electricity Cost Calculator
Calculate electricity costs for home appliances. Add appliances with wattage and daily usage, set your rate per kWh, and see daily, monthly and annual costs.
Fuel Calculator
Calculate road trip fuel costs, consumption, and CO₂ emissions. Supports MPG, L/100km, and km/L efficiency units with round-trip and cost-per-person options.
ROI Calculator
Calculate return on investment with net profit, ROI %, payback period, and annualized return.
Age Calculator
An interactive age calculator that computes exact age in years, months, and days from a birth date. Includes next birthday countdown, total days lived, zodiac sign, and day of week born.
Aspect Ratio Calculator
Calculate image or video dimensions, aspect ratios, and common presets for designers.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert Profit Margin Calculator from the Gutenberg inserter.