0

I'm trying to change the icon that appears next to a payment method. To do so I've tracked where the payment gateway plugin is getting the icon from, and I've found out this class with a url assigned to $this->icon:

class WC_Gateway_Rapyd_Card extends WC_Rapyd_Payment_Gateway {

    public function __construct() {
        $this->id                  = RAPYD_CARD_ID;
        $this->title               = RAPYD_CARD_TITLE;
        $this->method_title        = RAPYD_CARD_METHOD_TITLE;
        $this->description         = RAPYD_CARD_DESCRIPTION;
        /* translators: link */
        $this->method_description  = RAPYD_CARD_METHOD_DESCRIPTION;
        $this->has_fields          = true;
        $this->icon                = 'https://cdn.rapyd.net/plugins/icons/card_icon.png';
        $this->constructor_helper();
    }

    public function getCategory() {
        return RAPYD_CATEGORY_CARD;
    }
}

To change the icon I can update the current url with my own, but doing it this way would probably mean that I would have to do this every time the plugin is updated.

Would it be possible/advisable to assign the url to $this->icon inside this class from the functions.php?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
vsilvestre22
  • 101
  • 10
  • 3
    You would have to have the specific class _instance_ for that. And the property would have to be public (can’t tell from the code you have shown, whether it is.) No, this is rather not the way to go. You should rather look for a filter you can hook into, somewhere in the place where this data gets actually output to the frontend. – CBroe Mar 15 '21 at 13:18
  • Fair enough @CBroe, that is insightful. In that case I would look for a filter or ask the plugin developers if they can point me to the right direction to perform this change efficiently. Thank you! – vsilvestre22 Mar 15 '21 at 13:24

0 Answers0