WP Simple Pay: Custom Subscription Price Option Labels

/** * @link https://library.wpcode.com/snippet/e5009459/ */ add_filter( ‘simpay_plan_name_label’, /** * @param string $label Plan label. * @param \Stripe\Plan $plan Stripe Plan. * @return string */ function( $label, $plan ) { return sprintf( ‘%1$s %2$s %3$s every %4$s %5$s(s)’, $plan->name, simpay_format_currency( simpay_convert_amount_to_dollars(…Continue reading

WP Simple Pay: Custom Decimal Separator

/** * @link https://library.wpcode.com/snippet/e500y359/ * * @param string $separator Decimal separator. * @return string */ function simpay_custom_decimal_separator( $separator ) { return ‘,’; } add_filter( ‘simpay_decimal_separator’, ‘simpay_custom_decimal_separator’ );Continue reading

WP Simple Pay: Remove Decimals

/** * @link https://library.wpcode.com/snippet/j57zqp2g/ */ add_filter( ‘simpay_decimal_places’, /** * @param int $places Number of decimal places. * @return int */ function( $places ) { return 0; } );Continue reading

WP Simple Pay: Set a Per-Form Custom Amount Programmatically

/** * @link https://library.wpcode.com/snippet/7oq8llow/ * * @param \SimplePay\Core\PaymentForm\PriceOption[] $price_options Payment form price options. * @param \SimplePay\Core\Abstracts\Form $form Payment form. * @return \SimplePay\Core\PaymentForm\PriceOption[] */ add_filter( ‘simpay_get_payment_form_price_options’, function( $price_options, $form ) { // BEGIN UPDATES. $form_id = 150; // Payment form ID.…Continue reading

WP Simple Pay: Translate Stripe Error Messages

/** * @link https://library.wpcode.com/snippet/rov9rl2l/ */ add_filter( ‘simpay_get_localized_error_list’, /** * @param array $messages Stripe error messages. Keyed by error code. * @return array */ function( $messages ) { // https://stripe.com/docs/error-codes#coupon-expired $messages[‘coupon_expired’] = ‘The coupon has expired and is no longer valid’;…Continue reading