Created
November 21, 2018 11:10
-
-
Save hedqvist/9b961544342b63dd136d79336219072d to your computer and use it in GitHub Desktop.
Remove Postmeta from order row in Fortnox
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