amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
107 stars 76 forks source link

Virtual Products Not Showing Amazon Pay Button Next To Email Address #1166

Closed kevinjavitz closed 1 year ago

kevinjavitz commented 1 year ago

Your v2 module supports virtual products according to this thread. I have installed the latest version 5.14.1

With a regular product the amazon pay button shows: https://www.screencast.com/t/HIzWNLLEe

With virtual it does not: https://www.screencast.com/t/9VSni91JiUh

We use the latest version of Amasty One Step Checkout, but it seems it uses regular XML of checkout_index_index.xml so I don't think that's the problem.

Can you help so that the button shows up?

I have also emailed payments-cp-devel@amazon.com but have not heard back.

Your setup

sgabhart22 commented 1 year ago

Hello @salesigniter ,

Interesting, there should not be any difference in the display of the AP button dependent on product type unless the product is in a category that has been designated as restricted in the Amazon Pay configuration. And I don't believe the Amasty One Step Checkout module should be solely responsible for a conflict such as this; would you be able to provide a staging site where we could examine the behavior more closely?

Thanks, Spencer

kevinjavitz commented 1 year ago

Hi @sgabhart22 ,

I don't have an online staging site, but really it just requires to compare adding a regular product to cart which shows that express checkout button as shown in the screenshot, and then remove that product and add a virtual product (downloadable) to cart and checkout which does not show the shipping address section and therefor the express checkout button is not shown.

sgabhart22 commented 1 year ago

Thanks for the info, @salesigniter . After your explanation, I think the behavior might make sense regarding one-step checkout extensions, but it raises another interesting question about the nature of Express Checkout. One of the benefits of the Express Checkout flow is the automatic population of the shipping address and payment instrument. But with a virtual cart, the shipping step is omitted, and you'll be choosing the payment instrument (even if using Amazon Pay) in the payment section of a one-step checkout anyway. Even in a vanilla checkout (Luma theme), the Express Checkout button is not available at the billing/payment step of checkout when a customer has a virtual cart.

If a merchant sells virtual products and would like Amazon Pay to be available to customers to use as a payment method for these items, then enabling the Pay Now flow should take care of that even when using OSC extensions. This setting is found in the AP configuration under Advanced > Frontend > Amazon Pay in final checkout step. The customer will still need to enter their billing address manually, but will be able to use stored payment methods associated with their Amazon accounts.

If this solution is impossible or unfavorable for some reason, you should be able to either add some custom layouts/templates on top of the Amazon Pay module in order to add an Express Checkout button, or do the same to the Amasty OSC extension.

Please let us know if this helps, Spencer

kevinjavitz commented 1 year ago

@sgabhart22 thanks for this. yes that is exactly what I tried to do add some custom layout.xml so the button would show up but I still couldn't get it to show up. Can you tell me what custom layout to use in the checkout_index_index.xml file?

sgabhart22 commented 1 year ago

Hello again @salesigniter ,

In order to add an Express Checkout button to this area of the checkout, we need to add the amazon-button-region to the billing step in a checkout_index_index.xml file. If we put this in the 'before-login-form' region of 'customer-email', we can be sure it will only render in a virtual cart scenario since the email area is not rendered in the billing step of a physical cart.

Unfortunately this has a side effect of doubling the 'amazon-checkout-revert' component in the billing step, but we can use a layout processor to remove the duplicate. I created a small module called Amazon_AmastyAdapter including these customizations, and included the relevant files in a gist here: https://gist.github.com/sgabhart22/b344dfd092468eb9ea3bf0b481ebb1e2

Let me know if you have any further issues! Thanks, Spencer

sgabhart22 commented 1 year ago

Hi @salesigniter ,

Just wanted to check in and see if you had any success getting the AP button where you wanted it. Let us know if there's anything else we can do to help! Otherwise, we'll go ahead and close this issue in a couple weeks if we don't hear any more from you.

Thanks, Spencer

akshitaWaldia commented 1 year ago

Hello @salesigniter

Closing this issue. Feel free to reopen if you are still facing this.