• Resolved emilianoph

    (@emilianoph)


    I have added several fields to the checkout page, and I would like to have new box, where it is summarized:
    The gateway selected by the user (I Have 3 payments methods in such page: check, paypalexpress, card (stripe)).
    -The total amount of price corresponding to the selected price.

    And such fields should be automatically updated every time the user click on another different gateway.

    any clues to read such variables from a function and refresh it automatically?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Andrew Lima

    (@andrewza)

    Hi @emilianoph

    Thank you for reaching out to Paid Memberships Pro.

    You would need to use custom JavaScript to show data that is selected on the frontend.

    Hooking in on the ‘pmpro_checkout_before_submit_button’ may be a good place to display what information has been selected during the checkout process – https://www.paidmembershipspro.com/hook/pmpro_checkout_before_submit_button/

    This type of request is beyond the purpose of our support scope and a local developer may be able to assist you with this.

    Thread Starter emilianoph

    (@emilianoph)

    After reading a posts where from PmPro the gave this example:
    How to add a fee depending on the value of a radio button.
    https://gist.github.com/strangerstudios/9120040#file-my_pmpro_checkout_level-php
    I tried to replicate but I was not able to make it works.

    Anyway, from this information I could deduce that the idea that I need to apply to get what I published above, is to read the value of the radio button of the Payment Method.
    The problem that is I deduced that the name of such radio button could be ‘gateway’, but I think that it should be documented (I did not find any information about it).
    Thanks

    Plugin Author Andrew Lima

    (@andrewza)

    Thanks for the feedback, the gist shared manipulates the membership price based on selection but does not display any update on the frontend of the checkout page.

    For assistance with the code snippet, please open a support ticket on http://www.paidmembershipspro.com and someone from our team will continue to assist you in getting this to work.

    How are you adding multiple payment gateway options to your checkout page? Is this via custom code or an Add On?

    Thread Starter emilianoph

    (@emilianoph)

    I have these two add ons installed:

    PayPal Express Add On and Pay by Check Add On, so although in the settings of PMPro I have the ‘Stripe’ gateway selected, three options are shown in the checkout page:
    Card, Paypal and Check, as I want.

    Plugin Author Andrew Lima

    (@andrewza)

    Thank you for the feedback, we’re not allowed to support issues or requests related to premium products. This goes against the WordPress support guidelines – https://wordpress.org/support/guidelines/

    Please can you open a support ticket on https://www.paidmembershipspro.com so we may continue to assist you further with a solution.

    Thread Starter emilianoph

    (@emilianoph)

    Well, the key is to inspect the codes in github:
    Inside this code is the basic idea to read the gateway value checked in the radio buttons of the checkout page:

    https://github.com/strangerstudios/pmpro-add-paypal-express/blob/dev/pmpro-add-paypal-express.php

    Specifically:

    <script type=”text/javascript”>
    jQuery(document).ready(function() {

    //move paypal express button into submit box

    //detect gateway change
    jQuery(‘input[name=gateway]’).click(function() {
    var chosen_gateway = jQuery(this).val();
    if(chosen_gateway == ‘paypalexpress’) {
    // DO FUNCTION 1
    } else if(chosen_gateway == ‘check’) {
    // DO FUNCTION 2
    } else {
    // DO FUNCTION 3
    }
    });
    …

    </script>

    I tested and it works. I will prepare a basic code and I will publish it just in case someone need it.

    From my point of view, it should be documented ( I have the PRO version of PaidMembership)

    Plugin Author Andrew Lima

    (@andrewza)

    Thanks for the feedback, your code looks good to me.

    Please note we’re not allowed to support issues or requests related to premium products. This goes against the WordPress support guidelines – https://wordpress.org/support/guidelines/

    For further assistance, please can you open a ticket on https://www.paidmembershipspro.com

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Get the selected gateway in the checkout page’ is closed to new replies.