Home / Admin / WP Simple Pay: Use Payment Form Description as Payment Description
Duplicate Snippet

Embed Snippet on Your Site

WP Simple Pay: Use Payment Form Description as Payment Description

Always use the payment form's "Description" as the Stripe payment description.

By default WP Simple Pay uses the payment form's title as the payment description in Stripe, unless a custom label is specified for the selected price option.

Code Preview
php
<?php
/**
 * @link https://library.wpcode.com/editor/ro8wd9ow/
 */
add_filter(
	'simpay_get_paymentintent_args_from_payment_form_request',
	/**
	 * @param array<string, mixed> $args Payment Intent arguments.
	 * @param \SimplePay\Core\Abstracts\Form $form Form instance.
	 */
	function( $args, $form ) {
		$args['description'] = $form->item_description;
		return $args;
	},
	10,
	2
);

Comments

Add a Comment