Last active
January 12, 2024 11:36
-
-
Save tommyshellberg/f040888040182208c728121a2fb5cc88 to your computer and use it in GitHub Desktop.
WooCommerce Xero Override Line Item Account Code By SKU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_xero_line_item_account_code', 'wc_custom_xero_account_code', 10, 2); | |
function wc_custom_xero_account_code($account_code, $line_item) { | |
// $line_item->get_item_code() returns the SKU of the line item. | |
if( $line_item->get_item_code() == 'ACME') { | |
return '460'; | |
} | |
return $account_code; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there - looking at adapting this to assign categories of my products to different accounts. Can I just check this is the latest version?