Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @alexliii

    The gateway id for the Standard Card Button gateway is ppcp-card-button-gateway.

    This can be used in a slightly modified filter to add icons for this gateway: https://gist.github.com/InpsydeNiklas/08e0e488283dd5c278474c42710b72dc

    The team is also looking into adding native gateway icons. But I hope this helps!

    Kind regards,
    Niklas

    Thread Starter alexliii

    (@alexliii)

    Hello,

    I just did a try to add these two code snippets:

    The first one was added before

    function woocommerce_paypal_payments_card_button_gateway_icon( $icon, $id ) {
    
    ? ? if ( $id === 'ppcp-card-button-gateway' ) {
    
    ? ? ? ? return '
    
    <img src="https://mysite.com/wp-content/uploads/2022/05/creditcardicon.png" alt="Credit card" />';?
    
    ? ? } else {
    
    ? ? ? ? return $icon;
    
    ? ? }
    
    }
    
    add_filter( 'woocommerce_gateway_icon', 'woocommerce_paypal_payments_card_button_gateway_icon', 10, 2 );
    
    
    
    then, added the second one for Standard Card Button:

    And the second one for Paypal Standard card button:

    function woocommerce_paypal_payments_card_button_gateway_icon( $icon, $id ) {
    
        if ( $id === 'ppcp-card-button-gateway' ) {
    
            return '
    
    <img src="https://upload.wikimedia.org/wikipedia/commons/2/2a/Mastercard-logo.svg" alt="Mastercard" />
    
    <img src="https://upload.wikimedia.org/wikipedia/commons/0/04/Visa.svg" alt="Visa" /> 
    
    <img src="https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-100px.png" alt="PayPal Payments" />
    
    '; 
    
        } else {
    
            return $icon;
    
        }
    
    }
    
    add_filter( 'woocommerce_gateway_icon', 'woocommerce_paypal_payments_card_button_gateway_icon', 10, 2 );

    Question please:

    1# In this situation, the credit cart button will does not show up, but only show a button of “Place order”, could you have a try or optimize the code please?

    2# Is it possible to set a custom color for the button of “Debit or Credit Card” please?

    Thanks for support.

    Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @alexliii

    Redeclaring the same function name will not work and cause an error. I suggest combining this into a single filter, like this.

    Regarding the button color: PayPal provides a black and a white option for the standard card button, but the white option currently cannot be enabled in PayPal Payments. So currently the black button is the only option.
    We have planned to eventually add an option to enable the white button in the future. But there is very little customization possible with standard card payments, as this button and the smart card fields are provided by PayPal in an iframe.

    The Advanced Card Processing feature has more customization options, but this is limited to certain regions.

    Kind regards,
    Niklas

    Thread Starter alexliii

    (@alexliii)

    Much clear.

    It would be great if it support custom color so that it much match the theme color design.

    marked as resolved.

    thanks for support

    Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @alexliii,

    Custom colors for the standard card payments button, unfortunately, are not possible because this button is entirely controlled by PayPal. The regular PayPal buttons currently provide four possible color options, but these don’t affect the standard card button, and it remains black. We’re looking at providing as much customization options as possible, but we are in many ways limited to what PayPal provides.

    Kind regards,
    Niklas

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Code Snipptet for Standard Card Button’ is closed to new replies.