How to add an icon to the payment option block in the checkout page?

[ad_1]

Hi,

In the checkout page of my e-commerce I’d like to add an icon “logo.svg” before the name of the payment in the “label” field of the object passed to the method “registerPaymentMethod”.

How can I modify this code to accomplish this task?

(function() {
	"use strict";
	const settings = window.wc.wcSettings.getSetting( 'my_gateway_data', {} );
	const label = window.wp.htmlEntities.decodeEntities( settings.title || '' );
	const icon = settings.icon;
	const supports = settings.supports || '';
	const Content = () => {
			return window.wp.htmlEntities.decodeEntities( settings.description || '' );
	};
	console.log(settings);
	const Block_Gateway = {
			name: settings.id,
			label: label,
			content: Object( window.wp.element.createElement )( Content, null ),
			edit: Object( window.wp.element.createElement )( Content, null ),
			canMakePayment: () => true,
			ariaLabel: label,
			supports: {
				features: settings.supports,
			},
			supports: {
					features: supports,
			},
			icon: icon || '',
	};
	window.wc.wcBlocksRegistry.registerPaymentMethod( Block_Gateway );
})();

Thank you very much

Claudio

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer