Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Add Products to Order

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.

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_woocommerce capability 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

  1. Download add-to-order-script-1.0.0.zip from the latest GitHub release.
  2. In WordPress, open Plugins > Add New > Upload Plugin.
  3. Select the ZIP, install it, and activate Add Products to Order.
  4. Open WooCommerce > Add Products to Order.

You can also clone this repository into wp-content/plugins/add-to-order-script.

Usage

  1. Review the target order and note its numeric ID.
  2. Open WooCommerce > Add Products to Order.
  3. Enter the order ID.
  4. Read and select the confirmation checkbox.
  5. 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.

About

Safely add all published simple virtual WooCommerce products to a chosen order.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages