Populating Order Analysis fields directly.

Populating Order Analysis fields directly.

In Settings>Orders any order meta data item can be mapped to one of the 3 Sage order Analysis fields, by providing the meta key name. However, if you have custom fields that are not included in the order meta, then we have a filter for developers to use to directly populate the Analysis fields.

Add the following code to the website's functions.php (this example inserts the shipping method into Analysis 2)

add_filter('woosage_get_analysis_field', 'woosage_get_analysis_field', 10, 4);

function woosage_get_analysis_field($value, $order, $field_number, $meta_key) {

     // Return the shipping method title for analysis field 2
     if ($field_number === 2) {
          $value = $order->get_shipping_method();
     }

     return $value;

}

Replace the value of the field_number (2) with the Analysis field you wish to populate (1, 2 or 3) and set the value of $value to retrieve the data item you want to populate the Analysis field with using the relevant function.

    • Related Articles

    • What is Woosage for Sage Accounting?

      Woosage is a plugin for your website that will integrate your WooCommerce shop with Sage Accounting (also known as Sage Business Cloud Accounting - formerly Sage One). Woosage Essentials Edition is available and has the following features: Imports ...
    • Installation and Setup of Woosage for Sage Accounting

      Woosage for Sage Accounting is intended to be a self-install application and everything you need to do this is contained is right here in just 4 easy steps. Install the Woosage plugin Add your subscription Identifier Authorise Woosage to access your ...
    • Create an optional Sage Accounting user for Woosage

      While this step is optional, we we recommend that you add a Woosage user to allow us to access Sage Accounting on your behalf when installing WoosageBCA or providing ongoing support. If you do not add an additional user for Woosage, then we will not ...
    • Order Classifications

      Woosage50 provides a range of setting to allow you to override your default nominal and department code settings in Sage when Woosage is processing orders. If you do not want to override the Sage defaults for nominal codes or department codes, then ...
    • Last Order & Other Product Meta Data

      When Woosage50 updates website product data from Sage there are options to include Sage product data items that are not readily available in WooCommerce (e.g. barcode), so Woosage creates and populates custom fields with this data when these options ...