Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

This topic contains 25 replies, has 2 voices.

Last updated by Itamar 3 years, 9 months ago.

Assisted by: Itamar.

Author Posts
August 1, 2021 at 4:22 pm #9322891

raymondC-5

I use google chrome to inspect my page speed, go into source tab and notice a bunch of unneccessary files loading and slowing down the site. These files are associated with Stripe payment gateway.

August 1, 2021 at 5:50 pm #9322995

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I'm consulting our second-tier supporters regarding this issue with the WooCommerce Stripe Payment Gateway plugin and will get back to you tomorrow here when I have their reply.

Thank you for your patience.

Regards,
Itamar.

August 2, 2021 at 8:48 am #9325831

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Our second-tier supporter asked me to escalate this issue to our compatibility team. So I escalated it. They will check this issue and try to find a workaround or a quick fix for this issue. When I have news from our compatibility team, I'll update you here.

Thank you for your patience.
Itamar.

August 2, 2021 at 5:23 pm #9329673

raymondC-5

Thanks Itamar for checking this issue for me.

August 3, 2021 at 8:31 am #9333351

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

You are welcome.

This issue is now further escalated to our developers. I'll keep you updated when I have news regarding this issue.

Thank you for your patience.
Itamar.

August 10, 2021 at 4:54 pm #9377241

raymondC-5

havn't heard from you since the last 7 days, hopefully there is an update on this issue?

August 10, 2021 at 5:06 pm #9377257

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I'm sorry for the delay in getting back to you regarding this issue. I can see in our internal documentation that this is still in progress. I'm now sending a message to our second-tier supporters asking for an update on this issue. When I have their reply, I'll update you here.

Regards,
Itamar.

August 10, 2021 at 5:07 pm #9377261

raymondC-5

Hi

Just wondering if they are addressing this as a bug or a new feature to be released? i don't think it is a new feature to be considered, this should be treated as a bug.

August 10, 2021 at 6:34 pm #9377559

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Yes, I can see that the type of the related internal ticket is set to 'Bug'.

August 11, 2021 at 3:12 pm #9383567

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I have a workaround to share with you.

1. Take a full backup of your site.

2. Edit this file with a code editor.
wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-gateway-stripe.php

3. Look for this function:

	public function payment_scripts() {
		if (
			! is_product()
			&& ! WC_Stripe_Helper::has_cart_or_checkout_on_current_page()
			&& ! isset( $_GET['pay_for_order'] ) // wpcs: csrf ok.
			&& ! is_add_payment_method_page()
			&& ! isset( $_GET['change_payment_method'] ) // wpcs: csrf ok.
			&& ! ( ! empty( get_query_var( 'view-subscription' ) ) && is_callable( 'WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled' ) && WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled() )
			|| ( is_order_received_page() )
		) {
			return;
		}

4. Replace it with this modified function:

	public function payment_scripts() {
		if (
			! is_product()
			|| ! WC_Stripe_Helper::has_cart_or_checkout_on_current_page()
			&& ! isset( $_GET['pay_for_order'] ) // wpcs: csrf ok.
			&& ! is_add_payment_method_page()
			&& ! isset( $_GET['change_payment_method'] ) // wpcs: csrf ok.
			&& ! ( ! empty( get_query_var( 'view-subscription' ) ) && is_callable( 'WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled' ) && WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled() )
			|| ( is_order_received_page() )
		) {
			return;
		}

5. Save the file.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

Now the Stripe Payment Gateway remote JS resources will not be loaded when not needed.

I'll keep you updated here when I have news regarding this issue.

Regards,
Itamar.

August 11, 2021 at 5:07 pm #9384169

raymondC-5

This code looks like it is going to change the stripe plugin files. If there's an update with the stripe plugin, will it revert back to original files? I would think any changes would be under wpml side.

I haven't tested it because I'm making a staging site right now to test this behavior.

August 11, 2021 at 7:24 pm #9384857

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

You asked: "If there's an update with the stripe plugin, will it revert back to original files?"

Yes, this is true. If the WooCommerce Stripe Payment Gateway plugin will have a new version and you update it, the workaround will be overwritten, and you will need to apply it again.

As I mentioned, and I'm sorry if I was not clear enough, this is only a workaround we have provided you to enable you to continue working on your site without getting the problem of loading the JS resources when not needed. It is probably that the permanent fix will be included in WPML's files. Nevertheless, this is not up to me to decide. It is up to our developers to find a solution for this issue, whether it will be in WPML's files or WooCommerce Stripe Payment Gateway files with the cooperation of its developers.

Regards,
Itamar.

August 12, 2021 at 6:54 am #9387087

raymondC-5

I tried the code you provided, doesn't look like anything is changed. The code seems to be identical except for one line. Can you verify yif the code is incorrect?

From this:
&& ! WC_Stripe_Helper::has_cart_or_checkout_on_current_page()

To this:
|| ! WC_Stripe_Helper::has_cart_or_checkout_on_current_page()

August 12, 2021 at 9:23 am #9388417

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

The code is correct. Indeed this is the only change in this function.

Would you please make sure that you are checking this on products and pages where the "Apple Pay" and "Google Pay" button/option is unchecked?

Remember that if this option is active, then the resources will always load - according to Stripe support.

Regards,
Itamar.

August 12, 2021 at 9:52 am #9388591

raymondC-5

Apple Pay and Google Pay is disabled. These files should only be loaded on cart and checkout page. I am checking on product pages and still seeing the files being loaded.

Did you check on your sandbox site? You need to enter Stripe account details, using sandbox stripe will not trigger these files.