LoginSignup
0
0

More than 3 years have passed since last update.

Woocommerce 各決済方法への アイコン追加

Last updated at Posted at 2019-11-07

一発で済んだのでメモ。

アイコン画像がWoocommerceに同梱されているので
大体のクレカはコード追加のみでOK。
カード会社・画像ファイルは以下の通り。
カード会社/ファイル
Visa/visa
Master/mastercard
Diners/diners
JCB/jcb
Discover/discover
Maestro/maestro
laser/laser
Amex/amex

function my_add_icon( $icons, $gateway_id ) {
  if( $gateway_id == '{決済ID}' ){//該当の決済ID
 $icons .= '<img src="' . WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/{画像ファイル}.png' ) . '" alt="{カード会社}" style="width:40px;" />';//複数のカードを追加するときはこの行をコピーして追加
 }
 return $icons;
}
add_filter( 'woocommerce_gateway_icon', 'my_add_icon', 10 ,2);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0