How is the «Check out with PayPal» button implemented?

Context:


  • Case A: for the mini-cart dropdown
  • Case B: for the standalone cart page

1A. Magento_Checkout::minicart/content.html

2A. Magento\Checkout\CustomerData\Cart::getSectionData()

3A. Magento\Catalog\Block\ShortcutButtons::_beforeToHtml()

1B. Magento\Checkout\view\frontend\layout\checkout_cart_index.xml

2B.

It is not needed.

3B. Magento\Checkout\Block\QuoteShortcutButtons::_beforeToHtml()

4. Magento/Paypal/etc/frontend/events.xml

5. Magento\Paypal\Observer\AddPaypalShortcutsObserver::execute()

6. Magento\Paypal\Block\Express\InContext\Minicart\Button::shouldRender()

7. Magento\Paypal\Block\Express\InContext\Minicart\Button

8. Magento_Paypal::express/in-context/shortcut/button.phtml

9. Magento_Paypal/js/in-context/button

this.paypalButton is defined here:

10. Magento_Paypal::express/in-context/component.phtml


11. Magento_Paypal/view/frontend/layout/default.xml

12. Magento_Paypal/js/in-context/express-checkout