HaCos Posted August 20 Share Posted August 20 Hello Community, I'm reaching out because I need some assistance with modifying a custom field in the PayPal module on my PrestaShop site. **Current Setup:** - **PrestaShop Version:** 1.7.8.7 - **PayPal Module Version:** 6.3.0 - **PHP Version:** 7.4.33 I am using (https://github.com/202ecommerce/paypal) Whenever a transaction is made, a custom field is sent to PayPal that looks like this: 1.7.8.7_6.3.0_7.4.33_Cart ID: 123456_Shop name: my_store_name **What I Need to Do:** I would like to modify this custom field to include the Order ID, so it would look something like this: ``` Order ID: 123456 ``` **What I’ve Tried:** I've looked through the module files and suspect that the relevant code might be in files like `OrderCreateBody.php` or `OrderPatchBody.php` in the `services/Builder/` directory, but I haven't been able to pinpoint exactly where the string is being constructed. Could anyone guide me on which specific file and line I need to edit to include the Order ID in this custom field? If you've done something similar or have insights on where this data is assembled in the module, I would greatly appreciate your help! Thanks in advance, C Link to comment Share on other sites More sharing options...
Andrei H Posted August 20 Share Posted August 20 Hello, I have not used the PayPal module so I have a question. Does the module create the order before the user actually pays (when the pay with PayPal button is clicked)? If it does not, you will not be able to send the order id in the request. PrestaShop, unlike other ecommerce platforms, does not assign an order id to and order before it is created, you only have access to the cart id at that point. As a side note, I think this is the method you might be looking for: https://github.com/202ecommerce/paypal/blob/develop/classes/AbstractMethodPaypal.php#L529 1 Link to comment Share on other sites More sharing options...
HaCos Posted August 21 Author Share Posted August 21 Hello, Thank you so much for your insights and the quick response! You were absolutely right about the order ID not being available before the order is actually created in PrestaShop. Since the PayPal module processes the payment before the order is officially created, only the cart ID is accessible at that point. I followed your advice and checked the method you pointed out in `AbstractMethodPaypal.php`. I was able to replace the cart ID with the address ID successfully, and it’s now working perfectly. This solution fits our needs well since the address ID is more relevant for tracking in our specific workflow. Thanks again, C 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now