Support » Plugin: WooCommerce » Display Amazon Pay as a normal payment gateway?

  • Resolved dingdang



    Re Amazon Pay plugin for WooCommerce

    there was an old topic, marked as resolved, but it seems it is not:

    The simple question is (no need for double appearance asked there): is it possible to make the payment option to appear in the list of payment options but not to be on top of everything at the checkout page, asking to pay with Amazon.

    The goal here is to move it on the same level as all other options (like paypal, stripe), otherwise on first look the user will think that he HAS to login to Amazon to pay and wouldn’t scroll down to see there are other payment options.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Stef


    The only way to do that is with CSS or JS. I’m working on a plugin to enable it as a payment method but have other pressing matters right now.

    Depending on where you want it you will have to change the selector. You can add this for now to set it on top of your other payment methods.

    <script type="text/javascript">jQuery(".wc-amazon-checkout-message").insertBefore(".woocommerce-checkout-payment");</script>

    For me I’ve added it to the top here.

    Thanks. I made it a little more complicated (move that only if it is not logged in amazon so in case it is, the message “You’re logged in with your Amazon Account. Log out ยป” stays on top which is better).
    Ideally the plugin author should add this as an option.
    I’m not sure if I move it further (and create it trough JS as a radio button option) would mess woocommerce somehow.



    Let me know how it comes out. Would be interested in seeing. I agree, the current author needs to add it as a checkbox. I don’t want our customers always paying with Amazon. I’d rather put it at the bottom past PayPal since the margins are worse with Amazon Pay. Such is life.

    OK, I tried it and it is not possible.

    I’ve created a plugin with a new dummy payment gateway, just to have it in place and to move the amazonpay code there. BUT if something inside .woocommerce-checkout-payment is changed on the fly, woocommerce recreates the whole .woocommerce-checkout-payment, and so the inserted code disappears again.

    This should be done only inside the original plugin.

    The only workaround is yours, just to move the section on top of the .woocommerce-checkout-payment (and not inside it).



    That’s what I said earlier. That’s why I’m working on a plugin. Because the original plugin author WC won’t customize it for you.

    OK, I’ve got it to work as I want at the end without touching the original plugin here is the recipe:

    – using your way to move the .wc-amazon-checkout-message but only in case the user is not logged in amazon (this is where the button is active otherwise this section has a message to log out which is OK to be on the top)

    – I’ve created a dummy gateway plugin just to have a section there and an option, here is an example base:

    – I move the .wc-amazon-checkout-message section inside this new gateway BUT here is the important part:
    $( document.body ).on( ‘updated_checkout’, function() {
    .. insert the JS code here
    (thanks to stripe plugin for that). This guarantees that the insert will happen only after woo finishes his work creating the options section.

    – to be perfect, when amazon option (of the dummy plugin) is selected, I change the text of the “Place order” button to “Login to amazon” and onclick – a click to the amazonpay button is invoked (to go perform a login) – this is to prevent the order to be submitted trough the dummy gateway.

    Works perfectly that way.

    1. I suggest the author of the plugin to read this and to do it as a checkbox option.

    2. Another option is needed to hide the button in the cart page (they have an option to hide the original button, but not the amazon’s button)

    • This reply was modified 1 year, 1 month ago by dingdang.


    Yeah, well unfortunately WC won’t add this for some reason and I haven’t been involved for years so I’m just going to do my own thing and I’ll post to git when I’m done.

    Glad you got this resolved. Good job!

    I already created the plugin will upload it soon.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display Amazon Pay as a normal payment gateway?’ is closed to new replies.