Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

Attached screenshot

question from:https://stackoverflow.com/questions/66062910/sending-cart-item-data-to-paypal-woocommerce

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
386 views
Welcome To Ask or Share your Answers For Others

1 Answer

This plugin: https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout

Still uses the classic NVP API, as far as I'm aware.

So the parameters you need to add begin with L_ and are documented here: https://developer.paypal.com/docs/archive/express-checkout/integration-guide/ECCustomizing/#order-detail-parameters


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...