Change size from woocommerce PayPal checkout button in cart

Solution:

That PayPal image is being loaded from Paypal’s servers. So in order to change it you will have to modify the plugin code.

For PayPal button shape in checkout page navigate to: (line 46)

wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/includes/payment-forms/class-wc-braintree-paypal-payment-form.php

For PayPal button shape in cart page navigate to: (line 141)

wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/includes/class-wc-braintree-paypal-cart.php

$default_button_styles = array(
    label: 'checkout',       // pay | paypal | buynow | checkout | credit
    size:  'responsive',     // small | medium | large | responsive
    shape: 'rect',           // pill | rect
    color: 'gold',           // gold | blue | silver | black
    tagline: false,          // true | false   
    fundingicons: true,      // true | false
);

Use the below code in your functions.php file. Upload a Custom Paypal Logo in your Media Library and then replace that URL in “$express_checkout_img_url” in the below function.

// Hook in
add_filter( ‘woocommerce_paypal_express_checkout_button_img_url’ , ‘custom_override_woocommerce_paypal_express_checkout_button_img_url’ );

// Our hooked in function – $fields is passed via the filter!
function custom_override_woocommerce_paypal_express_checkout_button_img_url( $variablen ) {
$express_checkout_img_url = '/wp-content/themes/XXXXXX/images/M3_Logo_01.jpg';
return $express_checkout_img_url;
}

Check below URLs for some other ideas: https://docs.woocommerce.com/document/paypal-express-checkout/#section-7

https://isabelcastillo.com/change-woocommerce-paypal-icon-to-custom-image-with-credit-card-icons