Integrations

Connecting a WooCommerce store

Install the Margly plugin from the WordPress.org catalogue and click Connect — no keys to copy, and access is read-only.

7 min read

Connecting through the Margly plugin#

For WooCommerce we have an official Margly plugin in the WordPress.org catalogue. You install it in your admin, click Connect to Margly and the plugin does the rest: it creates read-only credentials, registers signed webhooks and hands them to us server to server. You don't copy anything anywhere, and no keys ever pass through your browser.

What you need#

  • WordPress 6.6 or newer and PHP 7.4 or newer
  • WooCommerce 9.0 or newer
  • A store on HTTPS — we won't send credentials over an unencrypted connection
  • A Margly account (a free trial is enough — you can create it while connecting)

Step by step#

  1. Install the Margly plugin

    In your WordPress admin go to Plugins → Add plugin, search for Margly and click Install. Then activate the plugin.

  2. Open WooCommerce → Margly

    After activation a Margly entry appears under WooCommerce in the left menu. Open it and click Connect to Margly.

    At that moment the plugin creates a read-only API key in your store and registers the webhooks. Nothing in the store is changed — the key doesn't allow Margly to write.

  3. Sign in to Margly

    The plugin redirects you to Margly. If you don't have an account yet, you create it right here and a 14-day trial starts.

  4. Confirm the connection

    Margly shows you which store this is and you confirm with Connect store. Margly sends the confirmation back to your WordPress and starts the first import.

You'll see the first data in Margly within a few minutes. With a large catalogue and a long order history the first import takes longer — you can follow its progress in the app.

What Margly reads from WooCommerce#

  • Orders — line items, quantities, prices, discounts, shipping, VAT, refunds, payment and fulfilment status, date
  • Products — names, SKUs, selling prices, VAT, stock, categories, visibility. Variations are treated as separate items, so you see margins per variation, not just per product.
  • Customers — the data needed for repeat-purchase rate and customer lifetime value

Margly is read-only — it never changes orders, products, prices or any setting in your store.

Purchase prices#

Without purchase prices margins can't be calculated, and WooCommerce doesn't have them as a standard field. Margly therefore looks for them in three places, in this order:

  1. Purchase prices in WooCommerce itself (the "Cost of Goods" feature, WooCommerce 10.3 and newer)
  2. The SkyVerge "Cost of Goods" plugin, if you use it
  3. The price stored on the product in the catalogue, when the order itself doesn't carry one

VAT#

WooCommerce always sends order line amounts excluding tax, with the tax separately, so we calculate each line's rate from your own numbers — we never substitute a rate based on your country. When an order or a line is untaxed, we store a genuine zero; inventing twenty-one per cent for a tax-exempt store would break the whole revenue calculation.

Order statuses#

Margly maps the standard WooCommerce statuses (pending payment, processing, on hold, completed, cancelled, refunded, failed) onto its own so that shops on different platforms can be compared. Drafts and trashed orders aren't stored at all.

If you add a status of your own with a plugin, Margly doesn't discard it — it classifies it by whether the order has been paid. So an order can never quietly vanish from your numbers.

Changes come through immediately#

The plugin registers nine signed webhooks — creation, update and deletion for orders, products and customers. A new order is therefore in Margly within minutes, not at the next scheduled sync.

Every request is signed with a shared secret and unsigned ones are rejected. What's more, a webhook never writes the data it carries — it only says that something changed, and Margly re-reads those orders or products from your store. A webhook delivered twice or out of order therefore can't corrupt your data.

What Margly watches on its own#

WooCommerce disables a webhook itself after five failed deliveries and never re-enables it. So once a day Margly checks your store and:

  • re-enables the webhooks WooCommerce switched off,
  • compares your order count with ours — and pulls in what's missing if they drift apart,
  • checks that orders haven't been renumbered (some plugins change order numbers); if they have, Margly matches them by an internal identifier that never changes.

You'll notice all this only by your numbers adding up — there's nothing for you to do.

Security#

  • The plugin creates credentials with read-only permission and passes them server to server — they never go through your browser.
  • On our side they're stored encrypted.
  • Webhooks are signed; unsigned requests are rejected.
  • The plugin adds no front-end code to your store and doesn't slow it down.

Common problems#

  • "The store must run on HTTPS" — we don't transfer credentials over an unencrypted connection. Install a certificate and start the connection again.
  • "Your WooCommerce version is too old" — update WooCommerce and try again.
  • "The pairing link has expired" / "has already been used" — the link is valid for 30 minutes and once only. Click Connect to Margly in your admin again.
  • "This store is already connected to another account" — one store can't be connected to two Margly accounts. Write to support@margly.io and we'll sort it out.
  • "The account has a different platform connected" — you're signed in with an account that already has another store connected. Connect the store to a different account (the button is right there on the page).
  • "Confirmation back to WordPress failed" — usually a security layer in front of your site (hosting protection, Wordfence and similar plugins) that didn't let our request through. Check that the plugin is active and try again.
  • "The WooCommerce connection is broken" — you received a notice that your store stopped accepting our requests. Almost always this is a security plugin blocking the REST API. In that case Margly does not deactivate your account and your data stays — it just isn't updated for a while. Allow access to the REST API and syncing resumes on its own.
  • Purchase prices missing — see the section above; without them we can't calculate margins.

Disconnecting and uninstalling#

You can disconnect in two ways and both do the same thing: with the Disconnect button on the Margly page in your WordPress admin, or by uninstalling the plugin completely. In both cases the plugin deletes the API key it created and all the webhooks, and lets Margly know the connection has ended.

Then this happens:

  • Margly stops fetching new data
  • You can still see the historical data in the app, it just isn't updated
  • A paid subscription is set to end at the end of the paid period — we won't charge you again
  • A 30-day window for keeping your data starts, and Margly sends you reminders during it (on day 3, 7, 14, 21 and 27)

If you re-activate and reconnect the plugin within 30 days, Margly picks up your original account and no data is lost. In the meantime Settings shows you a button that takes you straight to your plugins admin.

What next#

Was this helpful?

Related articles

A human reply

Didn't find your answer?

Write to us directly — we usually reply within 24 hours on business days.

support@margly.io