0

The goal is to render Paypal express button under the customer's email address field in checkout page.

Since the checkout page is render by jslayout, how can I insert the paypal express button block into an existing component. I have the following

<item name="shipping-step" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="shippingAddress" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="customer-email" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="paypal-express-button" xsi:type="array">
 <item name="component" xsi:type="string">Tcs_OnePageCheckout/js/view/paypal-express-button</item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>

Any idea on how to render paypal express button to the custom component that I created?

asked Apr 15, 2024 at 7:21

1 Answer 1

0

Use this:

```
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <body>
 <referenceContainer name="checkout.root">
 <block class="Magento\Checkout\Block\Onepage" name="checkout.onepage" template="Magento_Checkout::onepage.phtml">
 <arguments>
 <argument name="jsLayout" xsi:type="array">
 <item name="components" xsi:type="array">
 <item name="checkout" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="steps" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="shipping-step" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="shipping-address" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="before-shipping-method-form" xsi:type="array">
 <item name="children" xsi:type="array">
 <item name="paypal-button" xsi:type="array">
 <item name="component" xsi:type="string">Magento_Paypal/js/view/payment/paypal-express-button</item>
 <item name="displayArea" xsi:type="string">paypal-express-button</item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </item>
 </argument>
 </arguments>
 </block>
 </referenceContainer>
 </body>
</page>
```
Starship
2614 silver badges11 bronze badges
answered May 31, 2024 at 12:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.