PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 44 All time: 10,815 This week: 524Up
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: 287339 in Portugal Portugal
Week rank: 227 Up5 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 (4)  
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 (4)  /  src  
File Role Description
  Plain text file OrderStatus.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:44
This week:0
All time:10,815
This week:524Up
User Comments (1)
Thats a very good class ;-)
3 years ago (José Filipe Lopes Santos)
70%StarStarStarStar