The WooCommerce plugin for WordPress permits you to successfully create and arrange an ecommerce platform, offering get admission to to integrated notification options that provide you with a warning about new or finished orders, low inventory ranges, and a hit bills. Those options are very important however be offering simplest restricted insights into the dear information WooCommerce collects.

Such restrictions are the character of conventional plugins working inside the WordPress setting. Then again, hosted packages — web-based operations on exterior servers — are way more extensible.

By way of integrating with WooCommerce APIs and the use of exterior assets, hosted packages can give complex reporting, custom designed indicators, and detailed insights into ecommerce transactions.

On this information, discover ways to create a hosted utility that generates electronic mail indicators with complete transaction information, surpassing the features of the usual plugin.

Present Reporting and Notification Options

WooCommerce’s integrated indicators and standing updates help in very important retailer control however would possibly not fulfill all industry calls for. Subsequently, many customers flip to third-party plugins to reinforce their notification and reporting features.

One of the crucial most well liked plugins come with:

With those plugins, WooCommerce provides reporting and alert choices, together with order summaries, low inventory indicators, stock control, and in-depth analytics thru integration with gear like Google Analytics.

The Obstacles of Present Reporting Methods

Whilst really useful, the present reporting techniques have restricted features and introduce a number of barriers, reminiscent of:

  • Customization: Generic reporting gear and plugins limit the intensity and specificity of the insights your corporate can achieve from the knowledge. It’s possible you’ll require specialised metrics, distinctive visualizations, integration with proprietary analytics gear, or positive information filters no longer readily to be had in generic reporting gear and plugins.
  • Scalability: Present reporting techniques would possibly face scalability problems when coping with massive datasets. Gradual efficiency and information processing bottlenecks can hinder environment friendly information research, resulting in delays in decision-making and reaction occasions.
  • Dependency on WordPress: As the combination with WordPress limits independence, customization, and scalability, chances are you’ll face constraints associated with server assets, plugin compatibility, and safety vulnerabilities. This integration may additionally obstruct your enterprise from adopting extra complex applied sciences and answers.

By contrast, a custom designed reporting utility can give detailed transaction and buyer data. You’ll use this knowledge to look forward to marketplace traits and optimize your choices accordingly.

Additionally, you’ll temporarily scale a customized reporting utility to deal with rising information volumes, making sure seamless operations as your enterprise grows.

The Complex Reporting App

The complex reporting app envisioned on this information has the next purposes:

  • Detailed transaction indicators are emailed to the shop proprietor when the buyer puts a brand new order. The app additionally has a dashboard appearing a listing of all orders with their main points.
  • Stock updates display the retailer stock main points at the dashboard. From there, you’ll simply observe the inventory ranges of every product.
  • General gross sales reporting lets you analyze income traits over the years.

Not like generic plugins or the default WooCommerce notifications and alerting machine, this app provides detailed and customizable indicators about final stock and overall gross sales.

A number of benefits additionally come from internet hosting the applying, reminiscent of:

  • Scalability: Impartial internet hosting minimizes information processing bottlenecks, making sure you’ll increase operations with out useful resource constraints.
  • Customization: Impartial internet hosting permits you to tailor how you employ the gathered information, reminiscent of through integrating third-party services and products (like predictive analytics engines) and imposing distinctive information visualization ways to raised align together with your corporate’s necessities and targets.
  • Autonomy: Putting off your utility from the WordPress setting frees you from restrictions like restricted server assets and doable conflicts between quite a lot of plugins.

How To Increase an Complex Reporting App

On this phase, let’s construct a reporting app the use of Node.js with the WooCommerce REST API and webhooks to retrieve the shop information.


Configure the Starter Template

Observe those steps to configure the starter template:

  1. Have in mind of your Mailgun API key and sandbox area and paste their values within the .env report along their corresponding variables. For the MAILGUN_SENDER_EMAIL variable, give you the electronic mail you used to create the Mailgun account as the worth.
  2. To your WordPress admin dashboard, make a selection WooCommerce > Settings > Complex > REST API.

WooCommerce Advanced tab showing the REST API section. There is an Add Key button, a Search key field, a Bulk actions list, and an Apply button. Each key has a table with Description, Consumer key ending in, Permissions, and Last access columns.
WooCommerce Complex tab appearing the REST API phase.
  1. Click on Upload key to create the API key to authenticate requests out of your app.
  2. Open the Key main points phase and supply an outline and a consumer, make a selection Learn/Write permissions, and click on Generate API key.

WooCommerce Advanced tab shows the Key details section with Description and User fields and a Permissions list.
WooCommerce Complex tab appearing the API Key main points.
  1. Be certain that you replica the Client key and the Client secret from the ensuing web page, as you can not see them once more.
  2. Open the .env report and assign the values you copied within the earlier step to their respective variables. Supply your retailer’s URL for the WOOCOMMERCE_STORE_URL variable (one thing like http://localhost/mystore/index.php).
  3. Set up all of the venture dependencies through executing the next command on your terminal:
npm i specific @woocommerce/woocommerce-rest-api dotenv ejs mailgun.js

npm i -D nodemon

Those dependencies serve the next functions:

  • specific: Node.js framework to create an API.
  • @woocommerce/woocommerce-rest-api: Makes community calls to the WooCommerce REST API.
  • dotenv: Lots setting variables from the .env report.
  • ejs: Creates JavaScript templates.
  • mailgun.js: Sends emails the use of Mailgun.
  • nodemon: Restarts the server routinely when report adjustments are detected.

Enforce Utility Purposes

The starter template incorporates the code for rendering the embedded JavaScript (EJS) templates within the perspectives folder. This fashion, you’ll center of attention at the server common sense, which fetches the important information from the WooCommerce APIs and passes it to the EJS templates to show at the consumer interface (UI).

To enforce the applying’s capability, apply those steps:

  1. Create a report named server.js within the venture’s root folder. The report acts because the access level into the Categorical server.
  2. Paste the next code throughout the server.js report:
const specific = require('specific')
const WooCommerceRestApi = require("@woocommerce/woocommerce-rest-api").default;

const app = specific()
const port = 3000

const WooCommerce = new WooCommerceRestApi({
 url: procedure.env.WOOCOMMERCE_STORE_URL,
 consumerKey: procedure.env.WOOCOMMERCE_CONSUMER_KEY,
 consumerSecret: procedure.env.WOOCOMMERCE_SECRET_KEY,
 model: "wc/v3"

app.set('view engine', 'ejs')

// endpoint to test if the applying is up and operating
app.get('/', (req, res) => {
   res.ship('The applying is up and operating!')

// retrieve all merchandise within the retailer
app.get('/merchandise', (req, res) => {
       .then((reaction) => {
           res.render('pages/stock', {
               merchandise: reaction.information,
               currentPage: req.originalUrl
       .catch((error) => {

app.concentrate(port, () => {
 console.log(`App listening on port ${port}`)

The code above makes use of Categorical.js to create a cyber web server. You get started through uploading the specified applications, configuring the WooCommerce consumer to engage with the WooCommerce REST API, and surroundings the app to make use of EJS templates.

First, you outline a / endpoint that you’ll use to test if the applying is up and operating. Then, you outline a /merchandise direction that retrieves all of the merchandise from the WooCommerce retailer. If a hit, this direction renders the stock template with the fetched information.

Realize that the code additionally passes the currentPage to the template for all of the routes, and it is helping to spot the energetic pages at the dashboard.

  1. Run the command npm run dev and open http://localhost:3000/merchandise in your browser to view the effects:

Store Inventory page provides an image of the item, its Name, Date Created, Type, Status, Regular Price, Price, Total Sales, and Stock Quantity.
Retailer Stock web page with merchandise main points.

The Retailer Stock web page renders all of the merchandise to be had within the retailer along side their main points. This data is helping you stay observe of the to be had merchandise and arrange stock accordingly.

  1. To care for gross sales reporting, upload the next path to the server.js report:
// retrieve per 30 days gross sales record
app.get('/gross sales', (req, res) => {
   WooCommerce.get("experiences/gross sales", {
       		duration: "month"
       .then((reaction) => {
           res.render('pages/gross sales', {
               gross sales: reaction.information,
               currentPage: req.originalUrl
       .catch((error) => {

This code defines a /gross sales endpoint that retrieves the per 30 days gross sales record from the WooCommerce gross sales record API. The API name contains the parameter duration with the worth month, which specifies the present month’s gross sales record. As soon as the request is a hit, the code renders the gross sales EJS template with the fetched information.

  1. Navigate to http://localhost:3000/gross sales on your browser to view the effects:

Monthly Sales Report page with totals of Sales, Orders, Items Sold, and Refunds. Underneath is a table with Date, Sales, Orders, and Items Sold columns.
Per 30 days Gross sales File web page.

This web page shows a complete overall gross sales record, serving to you analyze your enterprise’s per 30 days income traits.

Enforce Order Control

  1. Upload the next path to the server.js report.
// retrieve all orders
app.get('/orders', (req, res) => {
       .then((reaction) => {
           res.render('pages/orders', {
               orders: reaction.information,
               currentPage: req.originalUrl
       .catch((error) => {

This code retrieves all orders from the WooCommerce retailer and renders the Orders template with the fetched information.

  1. Navigate to http://localhost:3000/orders on your browser to view the effects. This web page shows data for order control:

Orders page with a table containing the Customer, Currency, Number of Items, Created On, Discount, Shipping Fee, Cart Total, Payment Method, and Status columns.
Orders web page appearing transaction main points.

Customise Signals for Complete Transaction Reporting

To enforce the capability to ship you a custom designed electronic mail alert when a buyer orders in your website, apply those steps:

  1. Open a terminal window and run ngrok http 3000 to tunnel your cyber web server’s connection. This command generates an HTTPS hyperlink that WooCommerce can use to ship webhook information. Replica the generated forwarding hyperlink.
  2. Upload the next path to the server.js report:
app.put up('/woocommerce-webhook/new-order', (req, res) => {
   const information = req.frame; // Gained information from the WooCommerce webhook
   console.log('New order:', information);

       mg.messages.create(procedure.env.MAILGUN_SANDBOX_DOMAIN, {
           from: `WooCommerce Retailer <${process.env.MAILGUN_SENDER_EMAIL}> `,
           to: [process.env.MAILGUN_SENDER_EMAIL],
           topic: "New Order Created",
           html: newOrderEmail(information.order_key, `${information.billing.first_name} ${information.billing.last_name}`, information.billing.electronic mail, information.overall, information.standing, information.payment_method_title, information.line_items)
       .then(msg => console.log(msg)) // logs reaction information
       .catch(err => console.log(err)); // logs any error

   res.standing(200).ship('Webhook gained effectively'); // Ship a reaction to WooCommerce


This code defines a direction that handles incoming information from a WooCommerce webhook induced when a buyer creates a brand new order. If the gained information incorporates an identity belongings (indicating a sound order), it makes use of the Mailgun API to ship an electronic mail notification to the required electronic mail cope with.

The e-mail contains quite a lot of order main points reminiscent of buyer identify, electronic mail, overall quantity, standing, fee manner, and a listing of bought pieces.

The code composes the e-mail the use of the newOrderEMail() serve as outlined within the utils/new-order-email.js report, which returns a customized electronic mail template. After processing the knowledge and sending the e-mail, the server responds with a standing code 200, indicating a hit receipt of the webhook and a corresponding message (“Webhook gained effectively”).

  1. Upload the next commentary to import the newOrderEmail() serve as:
const { newOrderEmail } = require('./utils/new-order-email');
  1. Run the command npm run get started to start out the server.
  1. To your WordPress admin dashboard, make a selection WooCommerce > Settings > Complex > Webhooks.

Advanced tab showing the Webhooks section. It has an Add webhook button, an Actions list with an Apply button, and a table with Name, Status, Topic, and Delivery URL columns.
Complex web page appearing the Webhooks phase.
  1. Click on Upload webhook and give you the following data within the Webhook information shape:
    • Identify: New Order Alert
    • Standing: Energetic
    • Matter: Order Created
    • Supply URL: Paste the ngrok forwarding URL you copied in step 1. Be sure to append /woocommerce-webhook/new-order to the URL. That is the newly outlined endpoint for receiving the webhook payload.
  • Secret: Go away this clean. It defaults to the present API consumer’s shopper secret. The name of the game generates a hash of the delivered webhook within the request headers. The receiver can use this secret to ensure the authenticity of the incoming information. If the signature suits the predicted price, it confirms that the knowledge was once despatched through WooCommerce, offering agree with and safety.
  • API Model: WP REST API Integration v3.

Advanced page showing the Webhook data form. It has Name, Status, Topic, Delivery URL, Secret, and API Version fields with a Save webhook button.
Complex web page appearing the Webhook information shape.
  1. Click on Save webhook.
  1. Discuss with your retailer and position an order. You must see an electronic mail like the only underneath:

New Order Created email with the Order ID, Customer Name, Order Total, Order Status, Payment Method, and Line Items specifying their Name, Quantity, and Total.
Electronic mail alert for a brand new order and stock data.

Deploy The entirety to Kinsta

With Kinsta, you’ll deploy no longer simplest your WordPress + WooCommence web site with Controlled WordPress Website hosting but in addition your new reporting utility with Utility Website hosting.

Our top rate internet hosting services and products be offering necessary options, reminiscent of:

  • Prime efficiency and implausible velocity: Kinsta hosts your websites and apps on Google Cloud Platform’s Top rate Tier Community with the quickest and maximum tough C2 machines, and edge-cached thru Cloudflare’s CDN with 260+ PoPs.
  • Fast and clear-cut deployment: for a blithe internet hosting revel in, Kinsta builds packages routinely and deploys WordPress websites without having for guide configuration. You’ll simply set up and expand your websites with DevKinsta, and submit them with a push of a button, leaving the server-side settings for our specialised engineering staff.
  • Protection: Your packages and internet sites are living in the back of two firewalls, with DDoS coverage and mitigation, HTTP/3 and TLS 1.3. They’re deployed to an remoted container, heading off visitors spikes from different packages interfering together with your manufacturing setting, in addition to contamination from malicious assaults from different websites.


Due to the versatility of exterior internet hosting, you created a sophisticated reporting app that updates the remainder stock ranges and offers complete overall gross sales reporting.

It additionally supplies detailed transaction indicators, providing real-time insights into particular transactions, together with product main points, amounts, and buyer data, so you’ll proactively arrange inventory and perceive gross sales traits and income patterns.

Able to grow to be your WooCommerce revel in? Take a look at Kinsta to enforce complex custom designed WooCommerce reporting.

The put up Construct an Complex Reporting App for Your WooCommerce Retailer gave the impression first on Kinsta®.

WP Hosting

[ continue ]