Include Event title and description on Paypal payment screen.

Home Forums Ticket Products Event Tickets Plus Include Event title and description on Paypal payment screen.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #971561
    wherethewall
    Participant

    I would like the Paypal screen to be informative about the event the customer is paying for.
    At the moment it only displays the tickets types.
    How can I change this?

    This link was very helpful for the description on the cart screens,
    https://theeventscalendar.com/support/forums/topic/include-event-title-and-description-in-woocommerce-new-order-email/
    but I need this information to carry through to Paypal.

    Many thanks,

    Rob

    #971610
    George
    Participant

    Hey Rob,

    Thanks for reaching out to us. When you describe wanting “the PayPal screen to be informative”, can you clarify exactly what you mean by “the PayPal screen”?

    Do you mean the checkout pages that are on your WordPress site as the user goes through the process of buying tickets? If so, take screenshots or just elaborate on the exact page in that process you are talking about.

    Or do you mean the actual PayPal.com purchase page that the user is directed to once they click “Purchase” on your site?

    I’m sorry for my confusion on this detail of your question, but I just want to be sure I address the right thing so we can help you out as fast and as effectively possible πŸ™‚

    Thanks Rob!
    George

    #971754
    wherethewall
    Participant

    Hi there,

    I mean the description of the product on the PayPal.com purchase page screen, which at the moment is simply saying “Adult” for example.
    This is limited description then appears on all the Paypal screens: payment screen, Paypal receipt and Paypal email.

    This will require a change to the fields that are submitted to Paypal but could you advise where to do this.

    Many thanks.

    #971857
    George
    Participant

    Hey Rob,

    Unfortunately, there is little that can be done to change the PayPal.com purchase page screen itself. You can make some general customizations from within your PayPal.com account, but not much can be added from within The Events Calendar itself. I’m sorry to disappoint here!

    Let us know if this helps clarify things or if you have any other questions or concerns.

    β€” George

    #971863
    wherethewall
    Participant

    Hi there,

    I’m not sure you’re understanding my question because we are talking about changing slightly the submitted form fields data from events calendar to Paypal regarding the products the user is buying.

    Just like the link I included in my opening post that neatly details how to change the woocommerce cart page from displaying “Adult” to saying “25th Dec Christmas Meal – Adult” in the product description, I want to do a similar change so that when the user is purchasing on the Paypal.com page, it doesn’t simply say under Product Description: “Adult”, it says more about the event they are buying the ticket for.

    Cmon! Can anyone else who understands what I am trying to describe help me out here, so we can get a useful knowledgebase answer to a question that a lot of people will want to use.

    Thanks.

    #971915
    wherethewall
    Participant

    Do I need to make a change inside woocommerce/gateways/paypal/includes/settings-paypal.php perhaps?

    #972070
    wherethewall
    Participant

    Here’s an image of the field that I would like to change.

    Paypal page

    Is it clear what I mean now, George?

    Cheers,

    Rob

    #972169
    George
    Participant

    Hi Rob,

    This is a customization outside of the scope of support we can provide, and while I can relate to your frustrations with that, let me explain why this is a bigger customization to make than it seems.

    I’ve understood your request well, and answered it accurately:

    Unfortunately, there is little that can be done to change the PayPal.com purchase page screen itself.

    Now, here are the reasons why this is the case:

    1. The PayPal request at checkout is sent by WooCommerce, not our own plugin, so we’re confined by what information WooCommerce will accept to send to PayPal. In other words, if WooCommerce does not allow a way to send richer product descriptions to PayPal, then nothing about our desires to do so will change that.

    2. PayPal itself only accepts certain data via its public API. So in the same way we are limited by WooCommerce, WooCommerce is limited by PayPal.

    3. We don’t own PayPal, so if we want to enable richer data on the checkout pages on paypal.com, but they don’t provide it, we can’t do much – if anything – to change that.

    These are all inherent limitations in the way things currently are, nothing personal about us trying to not help you or anything like that.

    In fact, quite the opposite – we’re happy to help as much as we can here, and as an example of what little customization CAN be done for the PayPal checkout pages, I will walk you through some code here.

    My comment about how we “don’t own PayPal” is a little obtuse, admittedly, but it truly is the limitation we cannot get around here. However, WooCommerce is a bit more flexible. We don’t own that either, but it’s open source code that you host yourself that we can edit a bit.

    So let’s do that now.

    To change the data that shows up in the section you highlighted on the paypal.com checkout screens, you’ll need to find where WooCommerce makes its API request to PayPal for purchasing the tickets.

    You can find the specific line of code where this happens in a method called add_line_item() in this file within WooCommerce:

    
    woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php
    

    In that method, there is a block of code like this:

    
    $this->line_items[ 'item_name_' . $index ]   = html_entity_decode( wc_trim_string( $item_name, 127 ), ENT_NOQUOTES, 'UTF-8' );
    $this->line_items[ 'quantity_' . $index ]    = $quantity;
    $this->line_items[ 'amount_' . $index ]      = $amount;
    $this->line_items[ 'item_number_' . $index ] = $item_number;
    

    The “item_name_” item there is the one that dictates the text used in the area of the PayPal.com checkout page that you highlighted. This is a screenshot of those item names for me from my test site β†’ https://cloudup.com/cpxLfhpuvLc.

    If you change the value of that array item to something else, then that value will be used instead. As an example, if you try this:

    
    $this->line_items[ 'item_name_' . $index ]   = 'Test!';
    

    Then the names at checkout will read like this: https://cloudup.com/cYvj4yqHZdZ

    Now, to actually make a customization to that value, do not make it right within that add_line_item() method. Head up to the prepare_line_items() method instead, and look for where add_line_item() is actually called from. It should look like this:

    
    $this->add_line_item( $item['name'], 1, $item['line_total'] );
    

    Instead of $item[‘name’], this is where you can add whatever you want. You can dive into this code and var_dump( $item ); to see what attributes you have on $item itself, or you can use something custom altogether there and use any info you need. As a final quick example, to make the same modification that displays ‘Test!’ text, you’d add that to the function like so:

    
    $this->add_line_item( 'Test!', 1, $item['line_total'] );
    

    The result: https://cloudup.com/cYvj4yqHZdZ

    Hopefully this helps. I would not recommend making core code edits to WooCommerce like this, since you will lose the code after the next time you update it and have to re-add the customization, but this is how to do it.

    β€” George

    #984715
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Include Event title and description on Paypal payment screen.’ is closed to new replies.