Hide the terms displayed in the PaymentElement form
Disable the terms text under the PaymentElement using a custom module.
Some payment methods inside the PaymentElement display terms relevant to their use. Use this guide to disable the terms text under the PaymentElement using a custom module.
See the API documentation for more information.
Create a new module
Create a new module with the following directory structure. Replace Vendor with your preferred vendor name.
Inside registration.php, register your module with Magento.
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Vendor_StripeCustomizations',
__DIR__
);
Inside the relevant part of the product, define the module and set up dependencies to make sure it loads after the Stripe module.
Inside the relevant part of the product, define the following plugin:
Inside the relevant part of the product, create the plugin class:
<?php
namespace Vendor\StripeCustomizations\Plugin\Helper;
class PaymentMethodOptions
{
/**
* After plugin for getPaymentElementTerms method.
*
* @param $subject
* @param array $result
* @return array
*/
public function afterGetPaymentElementTerms($subject, $result)
{
if (isset($result['paypal']))
{
// Can be 'auto', 'always', or 'never'. We recommend against using 'auto' due to the usage of deferred intents in the module.
$result['paypal'] = 'never';
}
return $result;
}
}
