pronamic/wp-pronamic-pay-woocommerce

Revise icon functionality

Closed this issue · 2 comments

We currently have an icon setting with a default value from PaymentMethods::get_icon_url( … ).

'icon' => [
'title' => __( 'Icon', 'pronamic_ideal' ),
'type' => 'text',
'description' => sprintf(
'%s%s',
$description_prefix,
__( 'This controls the icon which the user sees during checkout.', 'pronamic_ideal' )
),
'default' => '',
],

[
'id' => 'pronamic_pay_ideal',
'payment_method' => PaymentMethods::IDEAL,
'icon' => PaymentMethods::get_icon_url( PaymentMethods::IDEAL, $icon_size ),
'form_fields' => [
'description' => [
'default' => __( 'With iDEAL you can easily pay online in the secure environment of your own bank.', 'pronamic_ideal' ),
],
],
'check_active' => false,
],

The PaymentMethods::get_icon_url( … ) method is implemented in:

https://github.com/pronamic/wp-pay-core/blob/4f25fdf6f528448c21bd523abca9f041af09d81f/src/Core/PaymentMethods.php#L529-L552

For example, the icon link for the iDEAL payment method is currently:
https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/methods/ideal/method-ideal-wc-51x32.svg

We actually want to work towards having the icons included in Pronamic Pay and no longer being loaded via a CDN. However, to do this we need to prevent local file paths/URLs from being saved. If local plugin file paths/URLs are stored, we can never actually delete these files without causing 404s.

The https://github.com/mollie/WooCommerce plugin has the following settings for this:

  • Display logo ☑️ Display logo on checkout page. Default enabled
  • Enable custom logo ☑️ Enable the feature to add a custom logo for this gateway. This feature will have precedence over other logo options.
    • Upload custom logo Choose file

Scherm­afbeelding 2024-03-19 om 10 29 09

I suggest we change our settings to:

Icon:

  • 🔘 Default
  • 🔘 None
  • 🔘 Custom
    • URL: __________