Order Management
These hooks let developers customize Orders in the Cost Calculator.
ccb_after_create_order
This is a hook that creates a post with a post meta after creating an order and being triggered.
Parameters:
$order_data(Array)
$payment_data(Array)
Example:
add_action('ccb_after_create_order', 'create_post_after_order_created', 30, 2);
function create_post_after_order_created($order_data, $payment_data){
// Check if the order_data or payment_data contains the necessary information
if(isset($order_data['calc_id']) && isset($payment_data['total'])){
// Customize the post title based on the order data
$post_title = 'New Post for Calc ID ' . $order_data['calc_id'];
// Create a new post
$post_data = array(
'post_title' => $post_title, // Set the post title
'post_content' => 'This post is related to calculator ID ' . $order_data['calc_id'] . ' for total amount' . $payment_data['total'], // Set the post content
'post_status' => 'publish', // You can set the post status as per your requirement
'post_author' => 1, // Set the post author ID
'post_type' => 'post', // Set the post type
);
// Insert the post into the database
$post_id = wp_insert_post($post_data);
// Check if the post was successfully created
if($post_id){
// You can perform additional actions here if needed
// For example, you can update post meta data or perform any other tasks
update_post_meta($post_id, 'order_data', $order_data);
update_post_meta($post_id, 'payment_data', $payment_data);
}
}
}ccb_orders_list_query
This is a hook for filtering orders in the admin. This hook allows you to change which orders will be loaded in the dashboard.
Parameters:
$args(Array).
Example:
ccb_orders_before_create
This hook gives input data before the order is created
Parameters:
$data(Array)
Example:
ccb_show_delete_order
This is a hook to hide the delete order button
Parameters:
$show(bool)
Example:
ccb_show_change_status
This is a hook to hide the button to change the order status
Parameters:
$show(bool)
Example:
ccb_show_bulk_actions
This is a hook to hide all bulk action buttons in the Orders tab
Parameters:
$show(bool)
Example:
ccb_after_delete_order
This is a hook to perform actions after deleting an order
Parameters:
$ids(Array)
Example:
Last updated
Was this helpful?

