Add paypal icon to the block checkout

This commit is contained in:
inpsyde-maticluznar 2024-10-18 09:47:42 +02:00
parent de609be21b
commit 82faf9370b
No known key found for this signature in database
GPG key ID: D005973F231309F6
2 changed files with 23 additions and 1 deletions

View file

@ -768,9 +768,24 @@ if ( block_enabled && config.enabled ) {
);
}
const PaypalLabel = ( { components, config } ) => {
const { PaymentMethodIcons } = components;
return (
<>
<span
dangerouslySetInnerHTML={ {
__html: config.title,
} }
/>
<PaymentMethodIcons icons={ config.icon } align="right" />
</>
);
};
registerPaymentMethod( {
name: config.id,
label: <div dangerouslySetInnerHTML={ { __html: config.title } } />,
label: <PaypalLabel config={ config } />,
content: descriptionElement,
edit: descriptionElement,
placeOrderButtonLabel: config.placeOrderButtonText,

View file

@ -248,6 +248,13 @@ class PayPalPaymentMethod extends AbstractPaymentMethodType {
return array(
'id' => $this->gateway->id,
'title' => $this->gateway->title,
'icon' => [
[
'id' => 'paypal',
'alt' => 'PayPal',
'src' => $this->gateway->icon
]
],
'description' => $this->gateway->description,
'enabled' => $this->settings_status->is_smart_button_enabled_for_location( $script_data['context'] ?? 'checkout' ),
'fundingSource' => $this->session_handler->funding_source(),