Skip to content

Instantly share code, notes, and snippets.

@Musilda
Created May 9, 2019 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Musilda/7744ef7eaa88db6af8c55f7ef994fa20 to your computer and use it in GitHub Desktop.
Save Musilda/7744ef7eaa88db6af8c55f7ef994fa20 to your computer and use it in GitHub Desktop.
<?php
//Add sku code into item name for invoice
add_filter( 'idoklad_order_item_name', 'custom_idoklad_item_name', 10, 2 );
function custom_idoklad_item_name( $name, $data ){
$_product = wc_get_product( $data['variation_id'] ? $data['variation_id'] : $data['product_id'] );
$sku = $_product->get_sku();
if( !empty( $sku ) ){
$name = $name . ' ' . $sku;
}
return $name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment