Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

POS Params

Paul Kilmurray edited this page Nov 8, 2015 · 7 revisions

Immediately on start up, the POS application makes a request to the server for important configuration settings, this includes:

  • Params, such as tax rates, default customer, menu items, etc. A full list of parameters can be found in the WC_POS_Params Class.
  • Templates, these are Handlebars templates used to render the various POS components. Templates can be found in the woocommerce-pos/includes/views directory.
  • i18n, the translation strings used in the POS application.

Filtering the POS Params

Using the woocommerce_pos_params filter you can customise the params before they are used to set up the POS application. Below are two examples of how to filter the POS params.

Adding a new product tab

function my_custom_pos_products_tab($params){
    $params['tabs']['posters'] = array(
        'label' => 'Posters',  // tab text
        'id' => 'cat:posters'  // product filter, see http://woopos.com.au/docs/products/product-searching-filtering/
    );
    return $params;
}
add_filter('woocommerce_pos_params', 'my_custom_pos_products_tab');

Adding a menu item

function my_custom_pos_menu_item($menu){
    array_push($menu, array(
        'id'     => 'my-custom-page',  // any unique id 
        'label'  => 'My Custom Page',  // menu 
        'href'   => '#my-custom-page'  // routing trigger
    ));
    return $menu;
}
add_filter('woocommerce_pos_menu', 'my_custom_pos_menu_item');

Removing a menu item

function my_custom_pos_menu($menu){
    foreach($menu as $key => $item){
        if($item['id'] == 'coupons')
            array_splice($menu, $key, 1);
    }
    return $menu;
}
add_filter('woocommerce_pos_menu', 'my_custom_pos_menu');
Clone this wiki locally