WP Manifestindependent plugin directory
manifest / ecommerce / tshirtecommerce-order-item-updater

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

0stars
0forks

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.zip

A 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

  1. Upload the plugin files to the /wp-content/plugins/tshirtecommerce-order-item-updater/ directory
  2. Activate the plugin through the 'Plugins' screen in WordPress
  3. 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

  1. Navigate to any WooCommerce order in the admin area (WooCommerce → Orders → Select Order)
  2. Scroll down to the order items section
  3. You'll see a new "TShirt Ecommerce Actions" box at the end of each order item's meta fields
  4. 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 users
  • wp_ajax_nopriv_tshirt_order_item_update: Handles AJAX requests for non-logged-in users
  • admin_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_orders capability
  • Data Sanitization: All input data is properly sanitized
  • SQL Injection Prevention: Uses WordPress meta functions to prevent SQL injection

Troubleshooting

Plugin Not Working

  1. Ensure WooCommerce is installed and activated
  2. Check that you're viewing the order details page in the admin area
  3. Verify that the order contains product items (not just shipping/fees)

AJAX Errors

  1. Check the browser console for JavaScript errors
  2. Verify that the user has proper permissions
  3. Check server error logs for PHP errors

Styling Issues

  1. Clear any caching plugins
  2. Check for theme conflicts by switching to a default theme
  3. 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.