Add Products to Order is a focused WooCommerce administration utility that adds one unit of every published, simple, virtual product to a chosen order.
Unlike the original one-off script this public plugin was based on, it does not target a hard-coded order or run automatically. An authorized administrator must enter an order ID and explicitly confirm each run.
- Lets an administrator choose the target WooCommerce order
- Adds published simple virtual products only
- Skips products already represented by a line item, making repeat runs safe
- Serializes changes per order and wraps mutations in a database transaction
- Recalculates order totals after successful additions
- Adds an order note recording the number of products added
- Requires the
manage_woocommercecapability and a valid nonce - Requires an explicit confirmation checkbox
- Declares WooCommerce High-Performance Order Storage compatibility
- WordPress 6.0 or newer
- PHP 7.4 or newer
- WooCommerce 8.0 or newer
- Download
add-to-order-script-1.0.0.zipfrom the latest GitHub release. - In WordPress, open Plugins > Add New > Upload Plugin.
- Select the ZIP, install it, and activate Add Products to Order.
- Open WooCommerce > Add Products to Order.
You can also clone this repository into
wp-content/plugins/add-to-order-script.
- Review the target order and note its numeric ID.
- Open WooCommerce > Add Products to Order.
- Enter the order ID.
- Read and select the confirmation checkbox.
- Select Add Missing Virtual Products.
The plugin locks the selected order, adds one unit of each eligible product that is not already present, then recalculates and saves the order within one database transaction. A failed request rolls its changes back, and a concurrent request for the same order is rejected. It does not charge the customer or send an email.
Adding products can change an order's subtotal, taxes, total, and outstanding amount. Test on a staging site first and review the result before taking any separate payment or fulfillment action.
Eligibility is intentionally narrow: the product must be published, simple, and virtual. Variable, grouped, external, draft, private, trashed, and physical products are not added.
The production source is maintained in the
coded-letter-monorepo
and released to this public repository. The plugin has no build step.
Validate PHP changes with:
php -l add-to-order-script.php
php -l includes/superfunky-release-client.php
php -l includes/superfunky-update-client.phpAdd Products to Order is free software licensed under the GNU General Public License v2.0 or later.