Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/coded-letter/add-to-order-script/releases/download/v1.0.0/add-to-order-script-1.0.0.zipAdd 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.
Features
- 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
Requirements
- WordPress 6.0 or newer
- PHP 7.4 or newer
- WooCommerce 8.0 or newer
Installation
- 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.
Usage
- 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.
Important behavior
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.
Development
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.php
License
Add Products to Order is free software licensed under the GNU General Public License v2.0 or later.
Releases
1 release. Each count is every asset in that release; expand a row for the breakdown.