Created
January 5, 2018 20:05
-
-
Save hedqvist/1d7576dda72bbb30326bced3f0fea8ec to your computer and use it in GitHub Desktop.
Remove Postmeta from OrderItem
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
<?php | |
/** | |
* @snippet WooCommerce - Fortnox plugin by Redlight Media - Remove and Post_meta rows in Fortnox via functions.php | |
* @author Redlight Media AB / Christopher Hedqvist | |
* @compatible WooCommerce 3.2.5 | |
*/ | |
function redlight_fortnox_remove_postmeta($orderData) { | |
foreach($orderData['Order']['OrderRows'] as $i => $item) { | |
if(isset($item['AccountNumber']) && $item['AccountNumber'] == 'API_BLANK') | |
unset($orderData['Order']['OrderRows'][$i]); | |
} | |
sort($orderData['Order']['OrderRows']); | |
return $orderData; | |
} | |
add_filter('obj_fortnox_order_data', 'redlight_fortnox_remove_postmeta', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment