ご注意!

この記事には PHP コードが含まれており、開発者を対象としています。このコードは便宜上提供していますが、コードのカスタマイズやサードパーティの開発についてはサポートを提供していません。

追加のガイダンスについては、WPBeginner の カスタムコードの追加方法に関するチュートリアル を参照してください。

閉じる

How to Exclude Failed Payments From PayPal Inside Form Locker Settings

Overview

Are you looking to exclude failed payments from the PayPal Standard addon affecting your Form Locker settings? By default, the Form Locker addon doesn’t consider payment statuses from any integrated payment gateway in your forms. However, with a quick code snippet, you can effortlessly exclude failed and even pending payments, ensuring that your form isn’t restricted for these types of submissions. We’ll guide you through the straightforward process to achieve this seamlessly!

スニペットの追加

Simply add this snippet to your site. If you need guidance in how to add snippets to your site, please review this tutorial.

/**
 * Exclude pending and failed payments from PayPal with Form Locker Entry Limit option
 *
 * @link https://wpforms.com/developers/how-to-exclude-failed-payments-from-paypal-inside-form-locker-settings/
 */

function wpf_dev_exclude_payment_status( $statuses ) {
	
	// Exclude failed payments from form locker settings
	$statuses[] = 'failed';
	// Exclude pending payments from form locker settings
	$statuses[] = 'pending';
	
	return $statuses;
}
add_filter( 'wpforms_locker_lockers_entry_limit_exclude_not_allowed_entries_excluded_statuses', 'wpf_dev_exclude_payment_status', 10, 1 );

This filter will automatically exclude any failed or pending PayPal Standard payments from affecting the Entry Limit you have set in your Form Locker settings.

And that’s it! Would you like to also control the Form Locker addon settings for the password? Take a look at our How to Make the Form Locker Password Non-Case Sensitive.

Filter Reference: wpforms_locker_lockers_entry_limit_exclude_not_allowed_entries_excluded_statuses

よくある質問

Q: Can I use this for PayPal Commerce addon?

A: Not at this time.