1

somehow Paypal acts strange. When checking out for our clients on Magento 2.3.X, they cannot chose different billing and shipping adresses. For all other payment methods that works.

See here. For Klarna, choice is given:

enter image description here

For PayPal somehow not:

enter image description here

Does anyone have an idead, how I can show the chechbox "My billing and shipping address are the same" also for PayPal?

Regards & thanks in advance

2
  • I think, once customer is redirected to the Paypal page, there he can set address and other info details.
    – fmsthird
    Commented Jun 10, 2020 at 9:15
  • Unfortunately not. I tried the same.
    – Ben
    Commented Jun 10, 2020 at 14:28

1 Answer 1

2
+50

I think this is by design.
Let's look at the differences in the templates for klarna and paypal.

Klarna is rendered by the template vendor/klarna/module-kp/view/frontend/web/template/payments/kp.html which has this section

    <div class="payment-method-billing-address">
        <!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
        <!-- ko template: getTemplate() --><!-- /ko -->
        <!--/ko-->
    </div>

getBillingAddressFormName is a function in the default payment method renderer vendor/magento/module-checkout/view/frontend/web/js/view/payment/default.js which returns 'billing-address-form-' + this.item.method so a static text plus the name of the payment method.
In this region, the billing address form is added from Magento\Checkout\Block\Checkout\LayoutProcessor::process method (dig deeper in that class and you end up in the method getBillingAddressComponent where you see 'displayArea' => 'billing-address-form-' . $paymentCode).
We can talk about how this works for a few hours but the short story is that the billing address form is added to all the payment methods in a specific area and then the method template can decide if it displays it or not and where to display it.

Now let's look at the paypal express method.
This is rendered by the template vendor/magento/module-paypal/view/frontend/web/template/payment/payflow-express.html.
This does not contain any trace of the text <!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) --> so it does not render the billing address form.
The only paypal payment methods that display the form are:

  • payflowpro (template vendor/magento/module-paypal/view/frontend/web/template/payment/payflowpro-form.html)
  • iframe (template vendor/magento/module-paypal/view/frontend/web/template/payment/iframe-methods.html)
  • paypal billing agreement (template vendor/magento/module-paypal/view/frontend/web/template/payment/paypal_billing_agreement-form.html)

If you are using one of these 3 methods and you don't get the billing address form it means I'm wrong and all I wrote above means nothing.
But if I'm right and this is "by design", I cannot answer the question to "why it is like this." Could be what fmsthird said in the comment above

2
  • Thank you so much for this detailed info Marius. Really appreciated. I will look into this but it sounds reasonable. It would mean that on that assumption if I add "<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) etc." that it should be in theory possible to add this address functionality, correct?
    – Ben
    Commented Jun 10, 2020 at 14:32
  • in theory yes, but it may be useless, if the server side does not handle this. You can try it just for the sake of it.
    – Marius
    Commented Jun 10, 2020 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.