Last active
July 23, 2024 17:03
-
-
Save InpsydeNiklas/ebdf6179c1e39428ae75fc7adf17063e to your computer and use it in GitHub Desktop.
PayPal Payments - set empty strings as product description in API request
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 | |
add_filter('ppcp_create_order_request_body_data', static function (array $data): array { | |
if (isset($data['purchase_units'][0]['items'][0]['description'])) { | |
$data['purchase_units'][0]['items'][0]['description'] = ''; | |
} | |
return $data; | |
}); | |
add_filter('ppcp_patch_order_request_body_data', function($patches_array) { | |
if (isset($patches_array[0]['value']['items'][0])) { | |
$patches_array[0]['value']['items'][0]['description'] = ''; | |
} | |
return $patches_array; | |
}, 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Its the product id which is different to the order id.