Started work on order projects
This commit is contained in:
@@ -16,6 +16,9 @@ class Wiaas_Order {
|
|||||||
private static $object_order_type = 'shop_order';
|
private static $object_order_type = 'shop_order';
|
||||||
|
|
||||||
public static function init() {
|
public static function init() {
|
||||||
|
|
||||||
|
require_once dirname( __FILE__ ) . '/order/class-wiaas-order-project.php';
|
||||||
|
|
||||||
add_action('woocommerce_new_order', array( __CLASS__, 'assign_order_to_organization' ));
|
add_action('woocommerce_new_order', array( __CLASS__, 'assign_order_to_organization' ));
|
||||||
|
|
||||||
add_filter('woocommerce_rest_check_permissions', array( __CLASS__, 'check_order_access'), 10, 4);
|
add_filter('woocommerce_rest_check_permissions', array( __CLASS__, 'check_order_access'), 10, 4);
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Wiaas_Order_Project {
|
||||||
|
|
||||||
|
public static function init() {
|
||||||
|
add_action('woocommerce_after_register_taxonomy', array(__CLASS__, 'register_order_project_taxonomy'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function register_order_project_taxonomy() {
|
||||||
|
$labels = array(
|
||||||
|
'name' => _x( 'Project', 'taxonomy general name', 'wiaas' ),
|
||||||
|
'singular_name' => _x( 'Project', 'taxonomy singular name', 'wiaas' ),
|
||||||
|
'search_items' => __( 'Search Order Projects', 'wiaas' ),
|
||||||
|
'all_items' => __( 'All Order Projects', 'wiaas' ),
|
||||||
|
'parent_item' => __( 'Parent Order Project', 'wiaas' ),
|
||||||
|
'parent_item_colon' => __( 'Parent Order Project:', 'wiaas' ),
|
||||||
|
'edit_item' => __( 'Edit Order Project', 'wiaas' ),
|
||||||
|
'update_item' => __( 'Update Order Project', 'wiaas' ),
|
||||||
|
'add_new_item' => __( 'Add New Order Project', 'wiaas' ),
|
||||||
|
'new_item_name' => __( 'New Order Project Name', 'wiaas' ),
|
||||||
|
'menu_name' => __( 'Order Project', 'wiaas' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
$args = array(
|
||||||
|
'hierarchical' => false,
|
||||||
|
'labels' => $labels,
|
||||||
|
'show_ui' => true,
|
||||||
|
'show_admin_column' => true,
|
||||||
|
'query_var' => true,
|
||||||
|
'rewrite' => array( 'slug' => 'shop_order_project' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
register_taxonomy( 'shop_order_project', array( 'shop_order' ), $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Wiaas_Order_Project::init();
|
||||||
Reference in New Issue
Block a user