Filters, Hooks & Snippets

Filters, Hooks & Snippets

  • For Adding External field in Order Header  #

$new_headers = array(

    'custom_external_fields'=>'ExtraFieldWoo',
    'custom_external_fields1'=>'Custom External Fields1',
    'custom_external_fields2'=>'Custom External Fields2',
    'custom_external_fields3'=>'Custom External Fields3',
    'custom_external_fields4'=>'Custom External Fields4'
);
apply_filters( "get_external_headers",  $new_headers);

 

 

  • For Adding External fields related product Header #

$new_headers = array(

    'custom_external_fields'=>'ExtraFieldWoo',
    'custom_external_fields1'=>'Custom External Fields1',
    'custom_external_fields2'=>'Custom External Fields2',
    'custom_external_fields3'=>'Custom External Fields3',
    'custom_external_fields4'=>'Custom External Fields4'
);

apply_filters( "get_ext_product_order_headers",  $new_headers);
  • Adding new custom orders use the below hook
    #

// Define the callback function
function add_status_and_sheets( $status_and_sheets ) {

// Modify the $status_and_sheets array
$status_and_sheets['query'] = 'Query'; 
// Adding a new key-value pair

// Return the modified array
return $status_and_sheets;
}

// Hook the callback function into the filter
add_filter( 'gscwoo_status_and_sheets', 'add_status_and_sheets' );

Create custom hooks for below plugins #

  1. Custom Order Numbers for WooCommerce

(https://wordpress.org/plugins/custom-order-numbers-for-woocommerce/)

$extra_headers = array(
    '_alg_wc_full_custom_order_number' => 'Custum Order Number'
);
apply_filters( "get_external_headers",  $extra_headers);
Go to Top