Created
March 12, 2021 15:33
-
-
Save summersab/bc8637a76a598c2b30569b826cd07d95 to your computer and use it in GitHub Desktop.
Remove `_links` element from FoxyCart responses
This file contains 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
function removeLinks($order) { | |
foreach ($order as $key=>$el) { | |
if (is_array($el)) { | |
if ($key === '_links') { | |
unset($order[$key]); | |
} | |
else { | |
$order[$key] = removeLinks($el); | |
} | |
} | |
} | |
return $order; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment