3

I'm currently having the issue, that I cannot remove the Checkout with Paypal Button that comes from a Payment Option called Paypal Express Checkout.
In the Magento2 Configuration settings I did set "Display on Product Details Page" to "NO", but it doesn't seem to disable it.

I did clear Cache multiple times and still does not work. I've seen multiple people having this problem.

enter image description here

4 Answers 4

0

Take a look:

vendor/magento/module-checkout/view/frontend/web/template/minicart/content.html

<div data-bind="html: getCartParam('extra_actions')"></div>

This button shortcut shows in this part.
The extra_actions cart data comes from:

vendor/magento/module-checkout/CustomerData/Cart.php

public function getSectionData()
{
    ......
    'extra_actions' => $this->layout->createBlock('Magento\Catalog\Block\ShortcutButtons')->toHtml(),
    ......   
}

Navigate to Magento\Catalog\Block\ShortcutButtons class, we will see a Dispatch shortcuts container event: shortcut_buttons_container.
The Paypal module will catch this event to add its button:

vendor/magento/module-paypal/etc/frontend/events.xml

<event name="shortcut_buttons_container">
        <observer name="paypal_shortcuts" instance="Magento\Paypal\Observer\AddPaypalShortcutsObserver"/>
</event>

In this event, it will checks the Paypal Method is available or not. So, the Paypal button will not show if the payment method is disable in Admin.

I did set "Display on Product Details Page" to "NO"

Yes, it will not affect on the minicart.

In this case, I have a suggestion for you. We can disable the paypal_shortcuts event, create the custom one. We can add more config for Paypal in Admin (e.g: Display on Mini Cart - Yes/No) and check this config in the custom event.

0

It it can help someone, to complete Khoa's answer. In you custom module, add this file: app/code/.../.../etc/frontend/events.xml With that content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="shortcut_buttons_container">
        <observer name="paypal_shortcuts" instance="Magento\Paypal\Observer\AddPaypalShortcutsObserver" disabled="true" />
    </event>
</config>
0

Try the following System -> Cache Management -> Additional Cache Managemtn -> Flush Static Files Cache. This should refresh the tempalates.

Additionally you can hide them with css

Try System -> Cache Management -> Additional Cache Managemtn -> Flush Static Files Cache

0

You can remove that shortcut using events.xml file

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="shortcut_buttons_container">
        <observer name="paypal_shortcuts" instance="Magento\Paypal\Observer\AddPaypalShortcutsObserver" disabled="true" />
    </event>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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