Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stephen Zuniga

    (@stephenzuniga001)

    There’s a filter you can add to your functions.php to replace the image url with your own. https://github.com/stezu/stripe-for-woocommerce/wiki/Hooks#s4wc_icon_url

    You would have to use photoshop or find an image online to use for your store. I would recommend uploading that image into your site and linking to it instead of linking to an external site from google.

    you can do that by adding following function in your gateway as well
    the function should be added in gateway class

    public function get_icon() {
    		$icon = '';
    		if(is_array($this->stripe_cardtypes))
    		{
            foreach ( $this->stripe_cardtypes as $card_type ) {
    
    				if ( $url = $this->get_payment_method_image_url( $card_type ) ) {
    
    					$icon .= '<img src="'.esc_url( $url ).'" alt="'.esc_attr( strtolower( $card_type ) ).'" />';
    				}
    			}
    		}
    		else
    		{
    			$icon .= '<img src="'.esc_url( plugins_url( 'images/stripe.png' , __FILE__ ) ).'" alt="Stripe Payment Gateway" />';
    		}
    
             return apply_filters( 's4wc_icon_url', $icon, $this->id );
    		}
    
    		public function get_payment_method_image_url( $type ) {
    
    		$image_type = strtolower( $type );
    				return  WC_HTTPS::force_https_url( plugins_url( 'images/' . $image_type . '.jpg' , __FILE__ ) );
    		}
    
    		/*Process Payment*/

    Also in plugin constructor the code should be like

    $this->icon             = plugins_url( 'images/stripe.png' , __FILE__ ) ;

    however you need to keep an images directory and place the cards logo as visa.jpg ,

    Another thing you need to add is an array in init_form_fields() function

    'stripe_cardtypes' => array(
    			 'title'    => __( 'Accepted Cards', 'woocommerce' ),
    			 'type'     => 'multiselect',
    			 'class'    => 'chosen_select',
    			 'css'      => 'width: 350px;',
    			 'desc_tip' => __( 'Select the card types to accept.', 'woocommerce' ),
    			 'options'  => array(
    				'mastercard'       => 'MasterCard',
    				'visa'             => 'Visa',
    				'discover'         => 'Discover',
    				'amex' 		       => 'American Express',
    				'jcb'		       => 'JCB',
    				'dinersclub'       => 'Dinners Club',
    			 ),
    			 'default' => array( 'mastercard', 'visa', 'discover', 'amex' ),
    			),

    and get an array of card types like this

    $this->stripe_cardtypes         = $this->get_option( 'stripe_cardtypes');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Accepted Cards Logos’ is closed to new replies.