Allow mixed cart support with Stripe Payment Elements

add_filter( ‘edd_gateway_supports’, ‘prefix_maybe_add_mixed_cart_support’, 999, 2 ); /** * Allow Stripe to support mixed carts. * Requires EDD 3.2.7. */ function prefix_maybe_add_mixed_cart_support( $supports, $gateway ) { if ( ‘stripe’ === $gateway ) { $supports[] = ‘mixed_cart’; } return $supports; }Continue reading

WooCommerce | Add product details as metadata in Stripe (separate lines)

// Product details in separate metadata lines + billing country + taxes + coupons add_filter(‘wc_stripe_intent_metadata’, ‘add_custom_stripe_metadata’, 10, 2); function add_custom_stripe_metadata($metadata, $order) { $count = 1; $billing_country = $order->get_billing_country(); // Get billing country $order_subtotal = $order->get_subtotal(); // Get order subtotal $cart_discount…Continue reading

MemberPress: Send Tax (e.g. VAT) to Stripe

add_action(‘mepr_stripe_create_customer_args’, function ($args, $usr) { $vat = sanitize_text_field($_REQUEST[‘mepr_vat_number’]); //Check one more time to make sure we have a vat number if (isset($vat) && !empty($vat)) { $tax_id = array( “type” => “eu_vat”, //Replace the “eu_vat” value with the predefined value of…Continue reading

Disable a Payment Gateway for a country on WooCommerce Checkout Page

/** * Snippet: Disable a Payment Gateway for a country */ add_filter( ‘woocommerce_available_payment_gateways’, ‘disable_payment_gateway_based_on_country’, 9999 ); function disable_payment_gateway_based_on_country( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( isset( $available_gateways[‘stripe’] ) && WC()->customer && WC()->customer->get_billing_country() == ‘IN’ ) {…Continue reading

MemberPress: Pass a Member Phone Number to Stripe

function mepr_pass_phone_number_to_stripe( $args, $user ) { $phone = get_user_meta( $user->ID, ‘mepr_phone’, true ); if ( ! empty( $phone ) ) { $args[‘phone’] = $phone; } return $args; } add_filter( ‘mepr_stripe_create_customer_args’, ‘mepr_pass_phone_number_to_stripe’, 10, 2 );Continue reading

WP Simple Pay: Facebook Payment Conversion Tracking

/** * @link https://library.wpcode.com/snippet/j57gg315/ */ add_action( ‘simpay_payment_receipt_viewed’, /** * Runs the first time the payment confirmation page is viewed. * * @param array $payment_confirmation_data */ function( $payment_confirmation_data ) { // Payment customer data (not used in this example). $customer =…Continue reading

WP Simple Pay: Add User Meta After Payment

/** * @link https://library.wpcode.com/snippet/qo9xxmjo/ * * @param \Stripe\Event $event Stripe Event. * @param \Stripe\Subscription|\Stripe\PaymentIntent $object Stripe Subscription or PaymentIntent */ function simpay_update_wp_user( $event, $object ) { $email_address = $object->customer->email; $wp_user = get_user_by( ’email’, $email_address ); // User cannot be found,…Continue reading

WP Simple Pay: Disable Stripe Payment Terms

/** * @link https://library.wpcode.com/snippet/ro8wy3ow/ */ add_filter( ‘simpay_payment_element_config’, /** * @param arary $params Payment Element configuration. * @return array */ function( $config ) { $config[‘terms’][‘usBankAccount’] = ‘never’; $config[‘terms’][‘card’] = ‘never’; return $config; } );Continue reading