I have created a custom code and added it to functions.php in the theme folder what exactly I am trying to do here is when the user redirects to the PayPal payment page he sees the order total amount I want to send cart data as well so the user can see what items he purchased I tried to rename the order items name but exactly facing the problem is at PayPal checkout page I see only order total not the whole product item is there a way to do that so the user can see the cart item data on the PayPal page for better understanding I also attached a screenshot
Below is the code which I tried to use though
add_filter('woocommerce_paypal_args', 'paypal_checkout_order_meta', 10, 2 );
function paypal_checkout_order_meta($args, $order) {
$args_keys = array_keys($args);
$i = 0;
foreach( $order->get_items() as $item_id => $item_product ){
$i++;
if( ! empty($args["item_name_".$i]) ){
$args["item_name_".$i] = "Item " . $i . " Order #" . $order->get_id();
}
}
return $args;
}
Can anyone please help me out with this?
question from:https://stackoverflow.com/questions/66062910/sending-cart-item-data-to-paypal-woocommerce