<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Carra Globe]]></title><description><![CDATA[Carra Globe is a global trade compliance and logistics company that acts as your Importer of Record, Exporter of Record, and DDP shipping partner across 175+ countries. When your goods hit a border, Carra Globe handles the customs clearance, import duties, regulatory filings, and legal compliance so your shipment moves through without interruption and without your business carrying the legal exposure.
carraglobe.com]]></description><link>https://carraglobe.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/69b6c499f4eb2f8b0493d4ef/b6b74f87-b61a-4b3f-ad15-7e946bad5420.png</url><title>Carra Globe</title><link>https://carraglobe.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 23:34:15 GMT</lastBuildDate><atom:link href="https://carraglobe.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Shipping interactive tools inside a WordPress page builder]]></title><description><![CDATA[Lessons from embedding free calculators in WordPress pages, from scoped CSS to delayed JavaScript and testing at phone width.]]></description><link>https://carraglobe.hashnode.dev/shipping-interactive-tools-inside-a-wordpress-page-builder</link><guid isPermaLink="true">https://carraglobe.hashnode.dev/shipping-interactive-tools-inside-a-wordpress-page-builder</guid><category><![CDATA[WordPress]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[CSS]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Carra Globe]]></dc:creator><pubDate>Sun, 29 Nov 2026 15:31:18 GMT</pubDate><content:encoded><![CDATA[<p>Most advice about building small web tools assumes you control the page. We don't. At Carra Globe our free tools live inside WordPress pages built with Elementor, next to a theme, an SEO plugin and a cache plugin that all have opinions.</p>
<p>Over months of shipping and fixing them, a few rules settled in. None are clever. All of them came from something breaking.</p>
<h2>One file, no head</h2>
<p>Each tool is a single HTML embed pasted into an HTML widget. There is no <code>&lt;!DOCTYPE&gt;</code>, no <code>&lt;head&gt;</code>, no <code>&lt;title&gt;</code> and no meta tags in it. The SEO plugin already writes those for the page, and a second set would duplicate them or fight over which one wins.</p>
<p>That rule surprised more than one code reviewer. Validators flag a missing doctype straight away. The answer is that this is a fragment, not a document, and treating it as a document is how you end up with two canonical tags.</p>
<h2>Scope everything to one wrapper</h2>
<p>Our first calculator looked fine on a blank test page and fell apart on the live one. The theme's styles for <code>select</code> elements stretched our dropdowns across the whole row and broke the cost estimator layout.</p>
<p>The fix was boring and permanent. Every selector now sits under a single wrapper class or ID, and the few controls the theme likes to restyle get explicit widths. The <a href="https://carraglobe.com/hs-code-finder/">HS Code Finder</a> scopes its CSS under one ID for the same reason, and its background is transparent so it sits on whatever colour the page uses instead of looking like a pasted box.</p>
<h2>Assume your JavaScript runs late</h2>
<p>This was the bug that cost the most time. A performance setting in the cache plugin delays scripts until the visitor first interacts with the page. That is good for load scores and bad for any markup that expects a script to be ready.</p>
<p>We had added a static placeholder row so the volumetric calculator would not look empty before the script ran. Under delayed loading, typing digits into that row stopped working, because the handlers were not attached yet. We removed the placeholder and let the script build the whole interface. Anything interactive now comes from the script or not at all.</p>
<h2>Wrap it, then export on purpose</h2>
<p>Each tool runs inside an IIFE in strict mode. That keeps dozens of helper functions out of the global scope, where they could collide with the theme or another plugin.</p>
<p>The catch is inline handlers. A button with <code>onclick="copyList()"</code> needs <code>copyList</code> on <code>window</code>. Rather than leaking everything, we export only what the markup calls, deliberately and in one place. When a function is not in that list, it cannot be called from the page.</p>
<h2>Let the builder do the builder's job</h2>
<p>The quote buttons in the HS Code Finder do not open their own modal. They use the page builder's existing popup through its action link, so the form, its tracking and its styling stay in one place that can be edited without touching tool code.</p>
<p>The same thinking applies to our <a href="https://carraglobe.com/import-export-glossary/">import and export glossary</a>, which is also a custom embed with search and category filters. The tool handles search, and the page handles everything around it.</p>
<h2>Test on the real page at phone width</h2>
<p>Most of our layout bugs only appeared on the live page at mobile widths. Text that fitted on a desktop preview spilled out of its card on a phone.</p>
<p>We now check releases on the published page at phone width, and run the code through an HTML validator and a page speed test before calling it done. The validator still complains about the missing doctype. That one we ignore.</p>
<h2>The short version</h2>
<p>If you are building tools that will be pasted into someone else's CMS, write a fragment, scope it tightly, assume late JavaScript and test where it actually lives. It is less elegant than a standalone app and far more useful, because the tool sits right where people already are.</p>
<p>At Carra Globe those people are mostly importers and logistics teams working out codes, weights and documents before a shipment moves. When the shipment needs a named importer in a country where they have no entity, that is the work of our <a href="https://carraglobe.com/importer-of-record-ior-services/">importer of record service</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Five chargeable weight bugs that hide in shipping calculators]]></title><description><![CDATA[Five bugs that skew chargeable weight calculators, from divisors and per-piece rounding to floating point errors, with code fixes.]]></description><link>https://carraglobe.hashnode.dev/five-chargeable-weight-bugs-that-hide-in-shipping-calculators</link><guid isPermaLink="true">https://carraglobe.hashnode.dev/five-chargeable-weight-bugs-that-hide-in-shipping-calculators</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[logistics]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Carra Globe]]></dc:creator><pubDate>Wed, 25 Nov 2026 07:34:30 GMT</pubDate><content:encoded><![CDATA[<p>Most shipping calculators get the headline formula right. Length times width times height, divide by a factor, compare with the actual weight, charge the bigger number. The bugs hide around that line, and they show up as a quote that differs from the invoice by a few kilos.</p>
<p>We rebuilt the free <a href="https://carraglobe.com/volumetric-weight-calculator/">volumetric weight calculator</a> on our site with these mistakes in mind. Here are the five that matter most, with the fix for each.</p>
<h2>1. One divisor for every mode</h2>
<p>The air freight standard comes from IATA practice. A consignment averaging more than 6,000 cubic centimetres per kilogram is charged on volume, which works out at roughly 167 kg per cubic metre. Express services commonly use 5,000 instead, which makes the same box heavier on paper. Sea freight is usually rated on one cubic metre against 1,000 kg, and road carriers publish their own factors.</p>
<p>Hard-coding 6000 is fine for a demo. In production the divisor belongs in configuration, chosen by mode and, ideally, by the carrier or forwarder actually quoting. Our tool lets you pick the divisor for air, road and sea, because a calculator that hides its divisor cannot be checked against a quote.</p>
<h2>2. Rounding the total when the carrier rounds per piece</h2>
<p>This is the one that causes arguments. Take three cartons of 40 by 30 by 21 cm at the air divisor.</p>
<p>Each carton comes to 25,200 cubic centimetres, or 4.2 kg volumetric. Rounded up to the next half kilogram per piece, that is 4.5 kg each and 13.5 kg in total. Add the volumes first and round once, and you get 75,600 cubic centimetres, 12.6 kg, rounded to 13 kg.</p>
<p>Half a kilo looks trivial until it repeats across every booking in a month. Express carrier guides generally describe the calculation piece by piece, while air cargo practice works on the consignment. The fix is to model both and make the rule explicit.</p>
<pre><code class="language-js">const volKg = (l, w, h, divisor) =&gt; (l * w * h) / divisor;
const ceilHalf = kg =&gt; Math.ceil(kg * 2 - 1e-9) / 2;

function chargeable(pieces, divisor, perPiece) {
  const actual = pieces.reduce((s, p) =&gt; s + p.kg, 0);
  const volume = perPiece
    ? pieces.reduce((s, p) =&gt; s + ceilHalf(volKg(p.l, p.w, p.h, divisor)), 0)
    : ceilHalf(pieces.reduce((s, p) =&gt; s + volKg(p.l, p.w, p.h, divisor), 0));
  return Math.max(ceilHalf(actual), volume);
}
</code></pre>
<h2>3. Floating point in the rounding step</h2>
<p>That small epsilon in <code>ceilHalf</code> is not decoration. JavaScript reports <code>0.1 * 3</code> as <code>0.30000000000000004</code>, and the same class of error can push a value that should be exactly 17.0 kg to 17.0000000001, which <code>Math.ceil</code> then lifts to 17.5.</p>
<p>Multiplying in whole centimetres keeps most inputs as integers until the final division. Where users enter decimals, subtracting a tiny epsilon before rounding up stops a value sitting on a boundary from jumping to the next band. Test the boundaries themselves, not just typical values.</p>
<h2>4. Mixing imperial and metric factors</h2>
<p>The imperial equivalents of the air standard are 166 cubic inches per pound and 366 cubic inches per kilogram. Calculators that accept inches but keep a metric divisor overstate the weight hugely, and calculators that convert inches to centimetres but round each dimension first drift by small amounts.</p>
<p>Convert once, at full precision, then apply a single metric divisor. Display the result in the unit the user chose.</p>
<h2>5. Measuring the box, not the shipment</h2>
<p>The IATA method uses the greatest length, greatest width and greatest height of each piece. A carton with a handle, a strap or an overhang is measured at its widest point. On a pallet, the shipment is the whole built unit including the pallet base, not the cartons stacked on it.</p>
<p>That is a data-entry problem more than a code problem, but the interface can help. Label the fields as outer dimensions, warn when the height looks too low for a palletised load, and show the cubic metres alongside the kilos so obvious typos stand out.</p>
<h2>Why the quote still differs sometimes</h2>
<p>Even a perfect calculator gives an estimate. The final figure depends on how the carrier measures at acceptance, on mode-specific minimums and on the rating rules in the actual contract. The goal of a good calculator is narrower and still worth having. Nobody should be surprised by more than the rounding rule they were told about.</p>
<p>When the weight feeds a real booking, it is the forwarder's numbers that count. Multi-piece air shipments of IT hardware make up most of what our <a href="https://carraglobe.com/freight-forwarding-services/">freight forwarding service</a> moves, and with those it pays to ask which rounding rule applies before comparing quotes, for exactly the reason in bug number two.</p>
<p>If your next question is how many cartons fit on a pallet before the volumetric weight overtakes the actual weight, our free <a href="https://carraglobe.com/pallet-calculator/">pallet calculator</a> plans the load in 3D so you can see it before you book.</p>
]]></content:encoded></item></channel></rss>