View wishlist“Givenchy Gentleman Eau de Toilette Intense - 100ml” has been added to your wishlist
1Product Found
-
(0)
Givenchy Gentleman Eau de Toilette Intense – 100ml
340Original price was: 340. 215Current price is: 215. Add to cart
/** * Prevent StellarPay / Stripe API crashes when email is null. * Injects a safe fallback email (no-reply@chicsouq.com) when missing. */ add_filter( 'http_response', function( $response, $r, $url ) { // Only process Stripe API responses if ( is_string( $url ) && strpos( $url, 'api.stripe.com' ) !== false ) { $body = wp_remote_retrieve_body( $response ); if ( empty( $body ) ) { return $response; } $data = json_decode( $body, true ); if ( ! is_array( $data ) ) { return $response; } // Adjust only for Stripe customer objects if ( isset( $data['object'] ) && $data['object'] === 'customer' ) { // If email is missing, null, or empty if ( ! isset( $data['email'] ) || $data['email'] === null || $data['email'] === '' ) { $email = ''; // 1) Checkout POST if ( ! empty( $_POST['billing_email'] ) ) { $email = sanitize_email( wp_unslash( $_POST['billing_email'] ) ); } // 2) WooCommerce session if ( empty( $email ) && function_exists( 'WC' ) && WC()->customer ) { $email = WC()->customer->get_billing_email(); } // 3) Logged-in WP user if ( empty( $email ) && is_user_logged_in() ) { $user = wp_get_current_user(); if ( ! empty( $user->user_email ) ) { $email = $user->user_email; } } // 4) Final fallback if ( empty( $email ) || ! is_email( $email ) ) { $email = 'no-reply@chicsouq.com'; } $data['email'] = (string) $email; // Replace the response body $response['body'] = wp_json_encode( $data ); // Optional: update content-length header if ( isset( $response['headers']['content-length'] ) ) { $response['headers']['content-length'] = strlen( $response['body'] ); } } } } return $response; }, 10, 3 );
السعودية