• This repository has been archived on 15/Jun/2022
  • Stars
    star
    477
  • Rank 92,112 (Top 2 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created about 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Store WooCommerce order data in a custom table for improved performance.

WooCommerce Custom Orders Table

Build Status Coverage Status

This plugin improves WooCommerce performance by introducing a custom table to hold all of the most common order information in a single, properly-indexed location.

Current State of the plugin

WooCommerce core is working on a custom order tables feature. The plan for the WooCommerce custom order table. More information can be found in this testing post. Call for early testing – custom order table migrations

Background

WooCommerce 3.0 introduced the notion of CRUD (Create, Read, Update, and Delete) interfaces in a move to unify the way WooCommerce data is stored and retrieved. However, orders are still stored as custom post types within WordPress, with each piece of order information (billing address, shipping address, taxes, totals, and more) being stored in post meta.

In fact, WooCommerce will typically create over 40 separate post meta entries for every single order. If your store receives even 10 orders a day, that means 400 new rows in the table every single day!

The larger the post meta table grows, the longer queries will take to execute, potentially slowing down queries (and thus page load times) for you and your visitors.

WooCommerce Custom Orders Table uses the WooCommerce CRUD design to save order data into a single, flat table that's optimized for WooCommerce queries; one order means only one new row, with minimal performance impact.

Requirements

WooCommerce Custom Orders Table requires WooCommerce 3.5.1 or newer.

If you're looking to migrate existing order data, you'll need to have the ability to run WP-CLI commands in your WooCommerce environment.

Migrating order data

After installing and activating the plugin, you'll need to migrate orders from post meta into the newly-created orders table.

The easiest way to accomplish this is via WP-CLI, and the plugin ships with three commands to help:

Counting the orders to be migrated

If you'd like to see the number of orders that have yet to be moved into the orders table, you can quickly retrieve this value with the count command:

$ wp wc orders-table count

Migrate order data from post meta to the orders table

The migrate command will flatten the most common post meta values for WooCommerce orders into a flat database table, optimized for performance.

$ wp wc orders-table migrate

Orders are queried in batches (determined via the --batch-size option) in order to reduce the memory footprint of the command (e.g. "only retrieve $size orders at a time"). Some environments may require a lower value than the default of 100.

Please note that migrate will delete the original order post meta rows after a successful migration. If you want to preserve these, include the --save-post-meta flag!

Options

--batch-size=<size>
The number of orders to process in each batch. Default is 100 orders per batch.
Passing `--batch-size=0` will disable batching.
--save-post-meta
Preserve the original post meta after a successful migration. Default behavior is to clean up post meta.

Copying data from the orders table into post meta

If you require the post meta fields to be present (or are removing the custom orders table plugin), you may rollback the migration at any time with the backfill command.

$ wp wc orders-table backfill

This command does the opposite of migrate, looping through the orders table and saving each column into the corresponding post meta key. Be aware that this may dramatically increase the size of your post meta table!

Options

--batch-size=<size>
The number of orders to process in each batch. Default is 100 orders per batch.
Passing `--batch-size=0` will disable batching.

Contributing

If you're interested in contributing to the development of the plugin or need to report an issue, please see the contributing guidelines for the project.

More Repositories

1

woocommerce-custom-thank-you

A WooCommerce extension that allows you to set a custom "Thank You" page on a global and individual product basis.
PHP
25
star
2

woo-cart-expiration

Set a time limit on a customer checking out.
PHP
19
star
3

LiquidWeb-WHMCS-Plugin

PHP
17
star
4

woocommerce-loadimpact

Scenarios for `loadimpact.com`, written against Liquid Web's WooCommerce sample data.
Lua
17
star
5

htaccess-validator

Lint and validate Apache2 Htaccess files
Shell
16
star
6

wp-orphans

WP-CLI command to automatically detect orphaned media files
PHP
15
star
7

woo-better-reviews

Like reviews, only way better.
PHP
11
star
8

liquidweb-cli

Official command line interface for the LiquidWeb API
Go
11
star
9

php-stormondemand

PHP bindings for the StormOnDemand API
PHP
10
star
10

wp-static-menus

Managed WooCommerce Hosting plugin
PHP
9
star
11

beaverbuilder-s3

Ensures compatibility between Beaver Builder and Human Made's S3 Uploads plugin.
PHP
8
star
12

liquidweb-woocommerce-gdpr

PHP
8
star
13

loadwatch

loadwatch tracks the health of a server, and logs information if conditions are met.
Shell
8
star
14

shopp-to-woocommerce

WP-CLI package for migrating Shopp sites into WooCommerce.
PHP
7
star
15

sticky-tax

Make posts sticky within the context of a single category, tag, or custom taxonomy term.
PHP
7
star
16

terraform-provider-liquidweb

Terraform Provider for Liquid Web's Storm web services
Go
6
star
17

woosimple

A simplified WooCommerce product page.
PHP
6
star
18

woo-interest-in-products

Allow customers to opt-in to information about individual products.
PHP
5
star
19

docker-machine-driver-liquidweb

Liquid Web Docker machine driver
Go
5
star
20

node-stormondemand

Node.js client bindings for the StormOnDemand API
JavaScript
5
star
21

lw-woo-gdpr-user-optins

A toolset to allow WooCommerce store owners to create and manage user opt-in data.
PHP
4
star
22

htaccess-validator-php

Composer package to leverage the htaccess-validator from within PHP applications
PHP
4
star
23

unique-templates

WP-CLI command to discover unique templates within a WordPress theme **WORK IN PROGRESS**
PHP
4
star
24

traffic-report

Display Google Analytics information directly within WP Admin. Requires Monster Insights.
PHP
3
star
25

go-lwApi

Minimalist LiquidWeb API Golang client
Go
3
star
26

ruby-stormondemand

A Ruby library for the Storm On Demand cloud APIs.
Ruby
3
star
27

plugins-to-storage

Plugins to Storage
Shell
2
star
28

liquidweb-go

Golang API client for Liquid Web's Storm API
Go
2
star
29

cert-manager-migration

Cert Manager Migration from BoltDB to PostgreSQL
Go
2
star
30

hello-server

Hello Server adds a node to the Toolbar that tells you what server your request was sent from! In the new Hello Server menu, you'll find the current server's hostname and IP.
PHP
2
star
31

cPanelToObjectStore

A Script To Facilitate Using Liquid Web's Object Storage for cPanel Backups
Python
1
star
32

newer-tag-cloud

PHP
1
star
33

acronis-policy-exporter

A Prometheus Exporter to monitor Acronis Policy State
Go
1
star
34

cert-manager-prometheus

Development instance of hooking up to cert manager's prometheus data
1
star