PHP Classes

Woocommerce Order Status Helper: Display the status of an order in WooCoomerce site

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 44 This week: 1All time: 10,758 This week: 560Up
Version License PHP version Categories
wc-order-status 1.0.0GNU General Publi...5PHP 5, Graphics, E-Commerce
Description 

Author

This class can create custom order statuses to help manage Woocommerce Web sites better.

It can register filters and action to have the order status class be called when a WooCommerce site is displaying the status of one or more orders in a page of the site.

The class can set the CSS styles that will be used to display each order status using colors with values that can be passed to the class as parameters.

Innovation Award
PHP Programming Innovation award nominee
May 2021
Number 3
Woocommerce is a popular extension of the WordPress platform that can turn a WordPress site into an e-commerce site that can sell products over the Internet.

This package provides a plugin that can improve the features of a Woocommerce site by enhancing the way the site's orders are displayed. It uses colors to mark orders in a listing depending on the status of the order.

Manuel Lemos
Picture of Carlos Artur Curvelo da Matos
  Performance   Level  
Name: Carlos Artur Curvelo da ... is available for providing paid consulting. Contact Carlos Artur Curvelo da ... .
Classes: 19 packages by
Country: Portugal Portugal
Age: 46
All time rank: 288639 in Portugal Portugal
Week rank: 411 Up3 in Portugal Portugal Up
Innovation award
Innovation award
Nominee: 13x

Winner: 2x

Documentation

wc-order-status

Adding custom order statuses to the Woocommerce platform could be definitely easier - and I am not talking about installing yet another plugin for dealing with silly tasks. This helper aims to automate and incept some intelligence to the way developers and web designers add, manage, style and even link behaviours and reactions to the custom statuses created.

First and foremost, we established a class to make the painful routine of adding custom statuses a single line of code.

Installation

No additional plugins, please. This library can be installed using Composer or, if you prefer, just download the main class OrderStatus and add to your project.

Usage

By definition, for adding a new status to WC orders we first need to register such status in Wordpress, and then include the newly added status to the pool where order statuses are saved within Woocommerce. So... why not doing that at once, instead of successive functions and hooks? So let's see how to simply add new statuses:

use WPH\WC\OrderStatus;
// Composer autoload
require __DIR__ . '/vendor/autoload.php';

/
 * Follow the format:
 new OrderStatus(STATUS_NAME, array(BACKGROUND_COLOR,FONT_COLOR*));
 * And that's it.
 */
new OrderStatus('Custom Status', array('orange', '#ededed'));

Obs: any CSS predefined color name and HEX color will work, but also any other format accepted in CSS (rgb, rgba, hsl, hsla).

Todo

We are planning some new features shortly. With new statuses, sometimes we face the need of trigger or hook functions or actions to them. So it makes sense to generate a controller class where you can encapsulate any kind of desired behavior. Also, we expect to add:

  • An easy way of customizing table actions and icons for new statuses
  • Autogenerated email templates for them
  • Support for Woocommerce Subscriptions

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file OrderStatus.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:44
This week:1
All time:10,758
This week:560Up
User Comments (1)
Thats a very good class ;-)
2 years ago (José Filipe Lopes Santos)
70%StarStarStarStar