Skip to content

Instantly share code, notes, and snippets.

@InpsydeNiklas
Last active July 23, 2024 17:03
Show Gist options
  • Save InpsydeNiklas/ebdf6179c1e39428ae75fc7adf17063e to your computer and use it in GitHub Desktop.
Save InpsydeNiklas/ebdf6179c1e39428ae75fc7adf17063e to your computer and use it in GitHub Desktop.
PayPal Payments - set empty strings as product description in API request
<?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);
@Bartosz-gd
Copy link

I used this code, but on PayPal recipe is an information "Order Item #1698" instead empty description. This number in description doesn't corespond with an order number. Can you help me?

@braddalton
Copy link

I used this code, but on PayPal recipe is an information "Order Item #1698" instead empty description. This number in description doesn't corespond with an order number. Can you help me?

Its the product id which is different to the order id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment