1

The Magento 2.3.1 upgrade changed our product page's PayPal Express button to an Iframe and we can't seem to revert the changes through the admin interface. We had configured the PayPal Express button to be modified through:

app/design/frontend/theme/default/Magento_Paypal/templates/express/shortcut.phtml

where we modified the button's image

...src="<?= $this->getViewFileUrl('images/paypalicon.png'); ?>"...

This seems to be a direct result of the 2.3.1 version's PayPal changes and the new frontend Smart Buttons that we'd like to disable, but we already have:

  • Customize set to No in PayPal Express Settings > Advanced Settings > Frontend Experience Settings > Product Page
  • We also have "No logo" set in PayPal Express Settings > Advanced Settings > Frontend Experience Settings

You can see the change below: enter image description here

Any suggestions or feedback would be greatly appreciated. Thanks!

| improve this question | | | | |
  • Try to set on Product Pages "Customize Button" to "Yes" and choose the label "PayPal", and Color "blue" – Ashen One Jul 2 '19 at 13:31
2

In 2.3.2, turning off 'In-Context' (Admin > Stores > Configuration > Sales > Payment Methods > PayPal Express Checkout > "Enable In-Context Checkout Experience" = No) resolved this issue for us, but then a PayPal Credit button also appeared (this seems to be a 2.3.2 bug: https://github.com/magento/magento2/issues/22528).

We manually forced the PayPal Credit button to hide with a plugin:

<?php
/**
 * User: mdubinsky
 * Date: 2019-08-07
 * Magento 2.3.2 bug - Disable PayPal credit
 */
namespace Vendor\Module\Plugin;

class Config
{
    public function afterIsMethodAvailable(\Magento\Paypal\Model\Config $subject, $result)
    {
        if ($subject->getMethodCode()==="paypal_express_bml"){
            return 0;
        }
        return $result;
    }
}

Alternatively, you can keep the 'In-context' setting and create a plugin to further customize the PayPal smart button more granularly. PayPal Resource: https://developer.paypal.com/docs/checkout/integration-features/customize-button/.

Plugin:

<?php
/**
 * Description: Plugin sets a standard PayPal button styles that aren't available in Magento Admin and align with our existing design
 * DISABLED in app/code/Vendor/Module/etc/di.xml because in-context experience is set to 'OFF"
 */

namespace Vendor\Module\Plugin;

class SmartButton
{
    /**
     * Get smart button config
     * Hard codes the desired payPal button style since these dynamic options are not available in the Admin
     * @return array
     */
    public function afterGetConfig(\Magento\Paypal\Model\SmartButtonConfig $subject, $result): array
    {
        $result['styles'] = $this->getButtonStylesPlugin();
        return $result;
    }

    private function getButtonStylesPlugin(): array
    {
            $styles['layout'] = 'horizontal';
            $styles['color'] = 'white';
            $styles['shape'] =  'pill';
            $styles['size'] =  'responsive';
            $styles['label'] = 'paypal';
            $styles['height'] = 38;
            $styles['tagline'] = false;
            $styles['fundingicons'] = false;

        return $styles;
    }
}

Now if you have issues with the PayPal login screen flashing and disappearing with a To check out, please sign in with your email address message. Then look at this resource: https://github.com/magento/magento2/issues/23761.

Override the JavaScript:

   ...if (cart().isGuestCheckoutAllowed === undefined) {
                cart.subscribe(function (updatedCart) {
                    this.declinePayment = !customer().firstname && !cart().isGuestCheckoutAllowed;
                    return updatedCart;
                }.bind(this));
            }...

Please let me know if I can elaborate on any of the above fixes. Hope this documentation helps someone else out there.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.