Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created January 18, 2019 18:06
Show Gist options
  • Select an option

  • Save hedqvist/6f6b64ce2091f4d3d23ae53d4fe0a46f to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/6f6b64ce2091f4d3d23ae53d4fe0a46f to your computer and use it in GitHub Desktop.
Update article name when updating products in Fortnox
<?php
/**
* @snippet WooCommerce - Fortnox plugin by Redlight Media - Update Article name to article in Fortnox via functions.php
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 3.5.3
*/
function redlight_update_article( $article, $product_id) {
$WC_Product = wc_get_product($product_id);
$article->Article['Description'] = $WC_Product->get_name();
return $article;
}
add_filter('obj_fortnox_article_data_before_update', 'redlight_update_article', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment