Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created July 5, 2018 06:46
Show Gist options
  • Select an option

  • Save hedqvist/61abec3d8b43c78ff639dfce9cc5c6bb to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/61abec3d8b43c78ff639dfce9cc5c6bb to your computer and use it in GitHub Desktop.
Custom field to REGISTRED USERS in Fortnox
<?php
/**
* @snippet WooCommerce - Fortnox plugin by Redlight Media - (REGISTRED USERS) Set $our_custom_field as Comment field to Fortnox via functions.php
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 3.0.6
*/
function redlight_custom_customerdata( $customer) {
$our_custom_field = (!empty($_POST['our_custom_field'])) ? $_POST['our_custom_field'] : "";
if(isset($our_custom_field)){
$customer['Customer']['Comments'] = $our_custom_field;
}
return $customer;
}
add_filter( 'obj_fortnox_customer_data', 'redlight_custom_customerdata');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment