Tshirtecommerce Order Item Updater
A WordPress plugin that adds custom action buttons to each order item in WooCommerce order details pages, specifically designed for TShirtecommerce functionality.
by phinq1910 · github.com/thuyydt/tshirtecommerce-order-item-updater · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/thuyydt/tshirtecommerce-order-item-updater/archive/refs/heads/main.zipA WordPress plugin that adds custom action buttons to each order item in WooCommerce order details pages, specifically designed for TShirt Ecommerce functionality.
Description
This plugin extends the WooCommerce order management interface by adding custom buttons at the end of each order item's meta fields. It's specifically designed to work with the TShirt Ecommerce plugin and provides additional functionality for managing custom designer data.
Features
- Order Item Actions: Adds custom action buttons to each order item in the admin order details page
- Custom Designer Data Integration: Works with existing TShirt Ecommerce custom designer data
- AJAX Functionality: All actions are performed via AJAX without page refresh
- User Permission Checks: Ensures only users with proper permissions can perform actions
- Order Notes: Automatically adds order notes when actions are performed
- Responsive Design: Mobile-friendly interface
- Accessibility: Supports high contrast and follows WordPress accessibility guidelines
Installation
- Upload the plugin files to the
/wp-content/plugins/tshirtecommerce-order-item-updater/directory - Activate the plugin through the 'Plugins' screen in WordPress
- The plugin will automatically start working on order details pages
Requirements
- WordPress 5.0 or higher
- WooCommerce 3.0 or higher
- PHP 7.0 or higher
- TShirt Ecommerce plugin (recommended)
Usage
- Navigate to any WooCommerce order in the admin area (WooCommerce → Orders → Select Order)
- Scroll down to the order items section
- You'll see a new "TShirt Ecommerce Actions" box at the end of each order item's meta fields
- Use the available buttons to perform actions on each item:
- Update Item Data: Updates the item's custom designer data
- Refresh Design Data: Refreshes design data from external sources
Button Actions
Update Item Data
- Updates the custom designer meta data associated with the order item
- Adds a timestamp of when the update was performed
- Records which user performed the update
- Adds an order note for tracking purposes
Refresh Design Data
- Refreshes design data from external sources (can be extended)
- Updates the refresh timestamp
- Records which user performed the refresh
- Adds an order note for tracking purposes
Hooks and Filters
The plugin uses the following WordPress/WooCommerce hooks:
woocommerce_order_item_meta_end: Adds the custom buttons (priority 100)wp_ajax_tshirt_order_item_update: Handles AJAX requests for logged-in userswp_ajax_nopriv_tshirt_order_item_update: Handles AJAX requests for non-logged-in usersadmin_enqueue_scripts: Loads admin scripts and styles
Development
Extending Functionality
You can extend the plugin's functionality by hooking into its actions:
// Example: Add custom processing after item update
add_action('tshirt_order_item_updated', function($order, $item, $custom_data) {
// Your custom code here
}, 10, 3);
Custom Actions
To add custom actions, you can extend the handle_order_item_update method by adding new action types in the switch statement.
File Structure
tshirtecommerce-order-item-updater/
├── tshirtecommerce-order-item-updater.php # Main plugin file
├── assets/
│ ├── admin.js # JavaScript for admin interface
│ └── admin.css # Styles for admin interface
└── README.md # This file
Security
The plugin includes several security measures:
- Nonce Verification: All AJAX requests are verified with WordPress nonces
- Capability Checks: Users must have
edit_shop_orderscapability - Data Sanitization: All input data is properly sanitized
- SQL Injection Prevention: Uses WordPress meta functions to prevent SQL injection
Troubleshooting
Plugin Not Working
- Ensure WooCommerce is installed and activated
- Check that you're viewing the order details page in the admin area
- Verify that the order contains product items (not just shipping/fees)
AJAX Errors
- Check the browser console for JavaScript errors
- Verify that the user has proper permissions
- Check server error logs for PHP errors
Styling Issues
- Clear any caching plugins
- Check for theme conflicts by switching to a default theme
- Ensure CSS files are loading properly
Changelog
1.0.0
- Initial release
- Added update item data functionality
- Added refresh design data functionality
- Implemented AJAX interface
- Added admin styles and scripts
- Added security measures and permission checks
Support
For support and feature requests, please contact the plugin developer or create an issue in the project repository.
License
This plugin is licensed under the GPL v2 or later.
Credits
Developed for TShirt Ecommerce integration with WooCommerce.