Issue with Email Address Removal at Checkout When Using WooPay Plugin

This topic has 10 replies, 2 voices, and was last updated 1 months, 1 weeks ago ago by Luca Rossi

  • Avatar: KB Creative
    KB Creative
    Participant
    November 26, 2024 at 14:12

    Hi there,

    We are currently experiencing an issue with the checkout process, while using the WooPay plugin.

    The problem occurs when the WooPay plugin is enabled: the email address field at checkout is being removed, which is causing difficulties for our customers and disrupting the order process.

    Could you please investigate this issue and let us know how we can resolve it?

    We also tried duplicating the checkout page here (as a regular page) and it works fine.
    https://marveloustales.mystagingwebsite.com/checkout-elementor/

    So it looks like it only have issue on the assigned checkout page.

    We have contacted Woocommerce support and this is what they said:
    “Since the email field appears on the duplicated checkout page (which I’m guessing uses a ‘regular’ template), I strongly suspect this might be more to do with the template override for the checkout page:
    https://developer.woocommerce.com/docs/template-structure-overriding-templates-via-a-theme/

    Please, contact administrator
    for this information.
    9 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    November 28, 2024 at 07:06

    Dear @KB Creative,

    We hope this message finds you well.

    Could you kindly provide us with the steps to reproduce the issue you are experiencing? From our end, the email address appears to be displaying correctly, as shown in the following screenshot: [https://prnt.sc/IoLvcJeKwvtI](https://prnt.sc/IoLvcJeKwvtI).

    Thank you for your assistance. We look forward to your response.

    Best regards,
    The 8Theme Team

    Avatar: KB Creative
    KB Creative
    Participant
    December 2, 2024 at 23:07

    Hi, we had to enable cartflow to temporary fix the issue.
    We’ve created a staging site: https://marveloustales-staging.mystagingwebsite.com/ – we’ve deactivated cartflow in this staging site

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    December 3, 2024 at 18:30

    Dear @KB Creative,

    We hope this message finds you well.

    To resolve the issue you are experiencing, we would like to propose two possible solutions:

    **1. Adding Custom Code to the functions.php File in Your Child Theme**
    Please add the following code snippet to the functions.php file of your child theme:

    
    add_action('woocommerce_before_checkout_billing_form', 'n2t_fields_before_billing_details', -50);
    function n2t_fields_before_billing_details() {
    		$checkout = WC()->checkout;
    
    		echo '<div class="woocommerce-billing-fields" id="contact_details">';
    
    		echo '<h3>' . esc_html( __( 'Contact information', 'woocommerce-payments' ) ) . '</h3>';
    
    		echo '<div class="woocommerce-billing-fields__field-wrapper">';
    		woocommerce_form_field(
    			'billing_email',
    			[
    				'type'        => 'email',
    				'label'       => __( 'Email address', 'woocommerce-payments' ),
    				'class'       => [ 'form-row-wide woopay-billing-email' ],
    				'input_class' => [ 'woopay-billing-email-input' ],
    				'validate'    => [ 'email' ],
    				'required'    => true,
    			],
    			$checkout->get_value( 'billing_email' )
    		);
    
    		echo '</div>';
    		echo '</div>';
    
    		// Ensure WC Blocks styles are enqueued so the spinner will show.
    		// This style is not enqueued be default when using a block theme and classic checkout.
    		wp_enqueue_style( 'wc-blocks-style' );
    	}
    

    **2. Using the Checkout Element from the Elementor Plugin**
    Alternatively, you can utilize the Checkout element provided by the Elementor plugin. Please refer to the following screenshot for guidance: [Screenshot Link](https://prnt.sc/al5YIVtnesK2).

    If you have any questions or require further assistance, please do not hesitate to reach out.

    Best regards,
    The 8Theme Team

    Avatar: KB Creative
    KB Creative
    Participant
    December 3, 2024 at 18:37

    We are getting this error when we try to add the code:

    Cannot redeclare n2t_fields_before_billing_details() (previously declared in /srv/htdocs/wp-content/plugins/insert-headers-and-footers/includes/class-wpcode-snippet-execute.php(389) : eval()’d code:2)

    Avatar: Justin
    Luca Rossi
    Support staff
    December 3, 2024 at 18:42

    Hi @KB Creative,

    We already added that code in your staging site.

    Best regards,
    The 8Theme Team

    Avatar: KB Creative
    KB Creative
    Participant
    December 3, 2024 at 18:46

    Thanks, the email address is still not still visible in the checkout

    Avatar: Justin
    Luca Rossi
    Support staff
    December 4, 2024 at 05:29

    Hi @KB Creative,

    Could you please check again?

    https://img001.prntscr.com/file/img001/ddPKHPeyRICq3KFP5rsdAw.png

    Thank you!

    Avatar: KB Creative
    KB Creative
    Participant
    December 4, 2024 at 11:15

    I see it’s working now thanks – how can we apply this to the live site?

    Avatar: Justin
    Luca Rossi
    Support staff
    December 5, 2024 at 05:12

    Dear @KB Creative,

    You just need to add this custom code under functions.php file locates in your child theme:

    
    add_action('woocommerce_before_checkout_billing_form', 'n2t_fields_before_billing_details', -50);
    function n2t_fields_before_billing_details() {
    	$checkout = WC()->checkout;
    
    	echo '<div class="woocommerce-billing-fields" id="contact_details">';
    
    	echo '<h3>' . esc_html( __( 'Contact information', 'woocommerce-payments' ) ) . '</h3>';
    
    	echo '<div class="woocommerce-billing-fields__field-wrapper">';
    	woocommerce_form_field(
    		'billing_email',
    		[
    			'type'        => 'email',
    			'label'       => __( 'Email address', 'woocommerce-payments' ),
    			'class'       => [ 'form-row-wide woopay-billing-email' ],
    			'input_class' => [ 'woopay-billing-email-input' ],
    			'validate'    => [ 'email' ],
    			'required'    => true,
    		],
    		$checkout->get_value( 'billing_email' )
    	);
    
    	echo '</div>';
    	echo '</div>';
    
    	// Ensure WC Blocks styles are enqueued so the spinner will show.
    	// This style is not enqueued be default when using a block theme and classic checkout.
    	wp_enqueue_style( 'wc-blocks-style' );
    }
    

    Hope it helps!

  • Viewing 10 results - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.