|
| 1 | +--- |
| 2 | +group: payment-services |
| 3 | +title: Customize buttons and messaging |
| 4 | +--- |
| 5 | + |
| 6 | +You can easily customize [PayPal Smart button styling](#paypal-smart-buttons) and [PayPal PayLater messaging, styling, and layout](#paypal-paylater) on the product page, the checkout page, in the shopping cart, and in the mini cart. |
| 7 | + |
| 8 | +## PayPal Smart Buttons |
| 9 | + |
| 10 | +To customize Smart Button styling, create a module with a dependency on `Magento_PaymentServicesPaypal`. |
| 11 | + |
| 12 | +1. In the [`di.xml` file]({{ site.baseurl }}{{ site.gdeurl }}/extension-dev-guide/build/di-xml-file.html), create a new type named `Magento\PaymentServicesPaypal\Block\SmartButtons`. |
| 13 | +1. In the `arguments` block, specify one argument named `componentConfig` and `xsi:type="array"`. |
| 14 | +1. Under this new argument, specify three items named `product`, `cart`, and `minicart` with `xsi:type="array"`. |
| 15 | +1. Under each item, specify a nested item named `styles` with `xsi:type="array"`. |
| 16 | +1. Reference [PayPal's available styling](https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/) and apply any desired parameters as nested items. |
| 17 | + |
| 18 | +``` xml |
| 19 | +<type name="Magento\PaymentServicesPaypal\Block\SmartButtons"> |
| 20 | + <arguments> |
| 21 | + <argument name="componentConfig" xsi:type="array"> |
| 22 | + <item name="product" xsi:type="array"> |
| 23 | + <item name="styles" xsi:type="array"> |
| 24 | + <item name="layout" xsi:type="string">horizontal</item> |
| 25 | + <item name="color" xsi:type="string">gold</item> |
| 26 | + <item name="shape" xsi:type="string">rect</item> |
| 27 | + <item name="label" xsi:type="string">paypal</item> |
| 28 | + <item name="tagline" xsi:type="boolean">false</item> |
| 29 | + </item> |
| 30 | + </item> |
| 31 | + <item name="cart" xsi:type="array"> |
| 32 | + <item name="styles" xsi:type="array"> |
| 33 | + <item name="layout" xsi:type="string">vertical</item> |
| 34 | + <item name="color" xsi:type="string">gold</item> |
| 35 | + <item name="shape" xsi:type="string">rect</item> |
| 36 | + <item name="label" xsi:type="string">paypal</item> |
| 37 | + <item name="tagline" xsi:type="boolean">false</item> |
| 38 | + </item> |
| 39 | + </item> |
| 40 | + <item name="minicart" xsi:type="array"> |
| 41 | + <item name="styles" xsi:type="array"> |
| 42 | + <item name="layout" xsi:type="string">vertical</item> |
| 43 | + <item name="color" xsi:type="string">gold</item> |
| 44 | + <item name="shape" xsi:type="string">rect</item> |
| 45 | + <item name="label" xsi:type="string">paypal</item> |
| 46 | + <item name="tagline" xsi:type="boolean">false</item> |
| 47 | + </item> |
| 48 | + </item> |
| 49 | + </argument> |
| 50 | + </arguments> |
| 51 | +</type> |
| 52 | +``` |
| 53 | +> Sample Smart Buttons customization |
| 54 | +
|
| 55 | +## PayPal PayLater |
| 56 | + |
| 57 | +To customize the PayPal PayLater messaging, style, and layout, create a module with a dependency on `Magento_PaymentServicesPaypal`, for the [product page, cart, minicart](#create-module-for-product-page-cart-and-minicart), or [checkout page](#create-module-for-checkout-page), and then [edit the styling of the module](#edit-the-styling). |
| 58 | + |
| 59 | +### Create module for product page, cart, and minicart |
| 60 | + |
| 61 | +1. In the [`di.xml` file]({{ site.baseurl }}{{ site.gdeurl }}/extension-dev-guide/build/di-xml-file.html), create a new `type` named `Magento\PaymentServicesPaypal\Block\Message`. |
| 62 | +1. In the `arguments` block, specify one argument named `componentConfig` and `xsi:type="array"`. |
| 63 | +1. Under this new argument, specify three items named `product`, `cart`, and `minicart` with `xsi:type="array"`. |
| 64 | + |
| 65 | +### Create module for checkout page |
| 66 | + |
| 67 | +1. In the [`di.xml` file]({{ site.baseurl }}{{ site.gdeurl }}/extension-dev-guide/build/di-xml-file.html), create a new type named `Magento\PaymentServicesPaypal\Model\SmartButtonsConfigProvider`. |
| 68 | +1. In the `arguments` block, specify one argument named `messageStyles` and `xsi:type="array"`. |
| 69 | + |
| 70 | +### Edit the styling |
| 71 | + |
| 72 | +1. Under each element (for the `product`, `cart`, `minicart`, or `checkout`), specify a nested item named `styles` with `xsi:type="array"`. |
| 73 | +1. Reference [PayPal's available styling](https://developer.paypal.com/docs/business/pay-later/us/integrate/customize-messages/) and apply any desired parameters as nested items. |
| 74 | + |
| 75 | +``` xml |
| 76 | +<type name="Magento\PaymentServicesPaypal\Block\Message"> |
| 77 | + <arguments> |
| 78 | + <argument name="componentConfig" xsi:type="array"> |
| 79 | + <item name="product" xsi:type="array"> |
| 80 | + <item name="styles" xsi:type="array"> |
| 81 | + <item name="layout" xsi:type="string">text</item> |
| 82 | + <item name="logo" xsi:type="array"> |
| 83 | + <item name="type" xsi:type="string">inline</item> |
| 84 | + </item> |
| 85 | + </item> |
| 86 | + </item> |
| 87 | + <item name="cart" xsi:type="array"> |
| 88 | + <item name="styles" xsi:type="array"> |
| 89 | + <item name="layout" xsi:type="string">text</item> |
| 90 | + <item name="logo" xsi:type="array"> |
| 91 | + <item name="type" xsi:type="string">inline</item> |
| 92 | + </item> |
| 93 | + </item> |
| 94 | + </item> |
| 95 | + <item name="minicart" xsi:type="array"> |
| 96 | + <item name="styles" xsi:type="array"> |
| 97 | + <item name="layout" xsi:type="string">text</item> |
| 98 | + <item name="logo" xsi:type="array"> |
| 99 | + <item name="type" xsi:type="string">inline</item> |
| 100 | + </item> |
| 101 | + </item> |
| 102 | + </item> |
| 103 | + </argument> |
| 104 | + </arguments> |
| 105 | +</type> |
| 106 | +<type name="Magento\PaymentServicesPaypal\Model\SmartButtonsConfigProvider"> |
| 107 | + <arguments> |
| 108 | + <argument name="messageStyles" xsi:type="array"> |
| 109 | + <item name="layout" xsi:type="string">text</item> |
| 110 | + <item name="logo" xsi:type="array"> |
| 111 | + <item name="type" xsi:type="string">inline</item> |
| 112 | + </item> |
| 113 | + </argument> |
| 114 | + </arguments> |
| 115 | + </type> |
| 116 | +``` |
| 117 | +> Sample PayLater customization |
0 commit comments