Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:

The following error occurs, and it is impossible to complete a translation.

Call to undefined function wc_get_default_product_type_options() /public_html/wp-content/plugins/woocommerce/includes/tracks/events/class-wc-products-tracking.php:242

Solution:

I can see this error when I go to WPML -> Support -> Advanced Translation Editor Error Logs. Please see the screenshot at the following link.

https://app.screencast.com/Tcm804YxP0Hp4?commentId=TATzGq2wSs6AdaMih6PhUG&conversation=IFUN2ItAKFQOBHt2OVwcwC&tab=Details

This is a known issue. We explain and provide a workaround for it at the following link.

https://wpml.org/errata/woocommerce-php-fatal-error-uncaught-error-call-to-undefined-function-wc_get_default_product_type_options/

Please apply the suggested workaround.

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.

This topic contains 10 replies, has 2 voices.

Last updated by mhd-eiadA 1 year, 11 months ago.

Assisted by: Itamar.

Author Posts
June 28, 2023 at 6:11 pm #13912973

mhd-eiadA

Dear WPML Support Team

Good Day

I have a problem in translation, please note the home page : hidden link

This is in the English page: (Image-1)

This how it looks in Arabic page:

Those are our product categories as they look in English version : (Image-2)

And this is how they look in Arabic language:

Please note the last item, also the order of the categories

One more thing:
In Arabic I have this : (Image-3)

The second item have no photo, in fact this item is cancelled (draft) in English version, but still appear here in Arabic version

Please help me to solve those problems

Thank you
Eiad

Image-3.jpg
Image-2.jpg
Image-1.jpg
June 29, 2023 at 6:04 pm #13920089

mhd-eiadA

Now it is not showing the translation at all, Today I added this item and translated it, but It is not working the second language version :

hidden link

June 30, 2023 at 9:25 am #13921977

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

I can see the problem with the images on the homepage of your site in Arabic.

To try and correct it, please go to WPML -> Settings and scroll down to the Media Translation section. There, please ensure that all the options for existing media are checked (they are checked by default). And press the 'Start' button and wait for the process to finish. Then go to the original product and press the Update button. And then update the translation of the product (with missing image). Check if it fixes the issue.

Please read about the Media translation options here.

https://wpml.org/documentation/getting-started-guide/media-translation/#id5

I do not see a problem with this product.

hidden link

When I switch to Arabic, I can see the translation.

hidden link

Please see the attached screenshot. Have you fixed this problem?

Regards,
Itamar.

2023-06-30_12-24-52.jpg
June 30, 2023 at 10:35 am #13922885

mhd-eiadA

Hi
I did as you instructed me. But nothing changed
for the photo you sent to me, it is not translated, it is in English, not Arabic.
Can I give you the username and password, so you could check by yourself ?? Is this chat a safe place ?
Thank you
Eiad

June 30, 2023 at 7:28 pm #13925559

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

HI, Eiad.

If you haven't done so, please check our guide on Media translation. You can learn how to translate images and replace an image to be different in other languages.

https://wpml.org/documentation/getting-started-guide/media-translation/

Have you followed our guide about this?

If you need further help with this, please share the access details to your site with me. Please explain to me which product to edit and which image you have the problem with.

I'm enabling a private message for the following reply.

Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
**IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--

Itamar.

July 1, 2023 at 4:46 pm #13927837

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi, Eiad, and thanks for the access details.

You made a small mistake in the username. But I realized it was a misspelling of the email address, and eventually, I could log into your site.

I'm sorry if I was not clear enough before about the following. In our support forum, we handle one issue per ticket. Since you brought up several issues, I want to ask you to open a separate ticket for each issue. Dealing with one issue pet ticket helps us, the supporters, to give you better support. Dealing with many issues in a ticket might also be confusing for you. In this answer, I'll give you tips about the other issues and tell you the issue we will focus on in this ticket.

The main issue we will focus on in this ticket is the fatal error on your site. The fatal error is:

Call to undefined function wc_get_default_product_type_options() /public_html/wp-content/plugins/woocommerce/includes/tracks/events/class-wc-products-tracking.php:242

I can see this error when I go to WPML -> Support -> Advanced Translation Editor Error Logs. Please see the screenshot at the following link.

hidden link

This is a known issue. We explain and provide a workaround for it at the following link.

https://wpml.org/errata/woocommerce-php-fatal-error-uncaught-error-call-to-undefined-function-wc_get_default_product_type_options/

Please apply the suggested workaround.

You should also increase the WP Memory Limit. I can see that your server's WP Memory Limit is set to 40M. Our recommendations are to have the following as minimal requirements:

- PHP 5.6 and above (this OK with your installation) with a WP Memory Limit of at least 128MB while 256MB is recommended.

MySQL 5.6 and above.

Please follow this link for detailed documentation:

https://wpml.org/home/minimum-requirements/

Is it possible for you to change those to the minimum requirement?

You may need to contact your hosting provider for that. Meeting those baseline requirements is critical before debugging and sometimes solves issues you experience. The most important thing is to raise the WP Memory Limit. Please try to raise it before you contact your hosting company. You can do it from the wp-config.php file in your WordPress installation. Insert this code in that file:

/** Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Add it before this line:

/* That's all, stop editing! Happy blogging. */


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

Please let me know once you completed the above, and I'll check your site again.

The product in Arabic is not showing the translation (3)

hidden link

The following message in the admin (6)

Some taxonomies in your site are forced to be untranslatable. This is causing a problem when you're trying to run a multilingual WooCommerce site.

A plugin or the theme are probably doing this.

What you can do:

1. Temporarily disable plugins and see if this message disappears.

2. Temporarily switch the theme and see if this message disappears.

It's best to contact WPML support, tell that you're getting this message and offer to send a Duplicator copy of the site. We will work with the theme/plugin author and fix the problem for good. In the meanwhile, we'll give you a temporary solution, so you're not stuck.

The above two issues might be related to the fatal error. So please proceed with my suggestions; we will check this issue after you add the correction.

-------------------------------------------------
Tips about the other issues

Translating images

When we say translating images, we mean using a different image for the translated product. Let's say that you have a product, and this product has different packages—a package in English for English-speaking customers and a package in Arabic for Arabic-speaking customers. So if you need to display the image with the package in Arabic for the translation of the product into Arabic, you can use WPML's Media translation. If you don't need to do this for any of your products or posts, it is better that you deactivate the Media translation add-on.

If you need further help with this issue, please open a separate ticket in our support forum.

The direction of the menu on the homepage (1)

This is probably not a WPML issue but a Right-to-left issue coming from your theme or a plugin.

If you need further help or explanations about this issue, please open a separate ticket in our support forum.

Images not showing in the slider (2)

This might be because of the same reason as the above issue. If you need further help or explanations about this issue, please open a separate ticket in our support forum.

Language Switcher in the mobile mode is not working (4)

If you need further help or explanations about this issue, please open a separate ticket in our support forum.

The message about cache and multi-currency in the admin (5)

In the settings of your caching plugin, you should be able to set not to cache pages for visitors with a cookie set in their browser.

If you need further help or explanations about this issue, please open a separate ticket in our support forum.

Regards,
Itamar.

July 1, 2023 at 10:20 pm #13928229

mhd-eiadA

Dear ITMAR,
I followed zour instructions, and I am attaching to you here my answer as photo files, but also I uploaded the word file to my google drive, and here I am sharing to you for easier access.

hidden link

I answered in red color
Thank you
Eiad

2023-07-01-Answer_4.jpg
2023-07-01-Answer_3.jpg
2023-07-01-Answer_2.jpg
2023-07-01-Answer_1.jpg
July 2, 2023 at 8:06 am #13928585

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi, Eiad, and thanks a lot for the detailed answers.

Out of the ordinary, I work this weekend.

Thanks for following my suggestions. I can see it helped to solve problems on your site. I also confirm that I see that the product is now translated. This solved the major problem.

I also solved the missing images from the "Our Products Categories" problem. Please see the attached screenshot Our-Products-Categories-images-ok.jpg. I went to WPML -> Settings -> Media translation, ensured that all the options were selected, and pressed the "Start" button. I then waited for the process to finish. There were thousands of images to handle, which took a few minutes. Please see the attached screenshot duplicate-media-runing.jpg. When the process finished, I could see the images on the homepage. Again, if you are not switching any images on the Arabic products to be different than the images on the English products, I suggest that you deactivate the WPML Media add-on.

I also solved the issue with the admin message about some taxonomies in your site being forced to be untranslatable. I went to WPML -> Settings -> Taxonomy Translation and changed all the untranslated taxonomies I knew should be set to "Translateable". Please see the attached screenshot Taxonomy-Translation-ok.jpg. Now the message does not show.

Please confirm that the issues of this ticket are solved now.

Please open new tickets for each issue that is not solved yet.

I can give you a tip regarding the "The direction of the menu on the homepage" issue. I found out that the following CSS directive causes it.

.nasa-rtl .nasa-menu-item-icon {
    margin-right: auto;
}

When I cancel this directive, the menu is aligned to the right. Please see the attached screenshot menu-aligned-to-right.jpg. This CSS directive is coming from your theme. If you know how you can try and overwrite it with custom CSS. Please get in touch with the support of your theme on this RTL issue. It is not related to WPML. The problem will be there even if WPML is not installed and Arabic is the only language of your site.

Best Regards,
Itamar.

Taxonomy-Translation-ok.jpg
duplicate-media-runing.jpg
Our-Products-Categories-images-ok.jpg
menu-aligned-to-right.jpg
July 2, 2023 at 10:00 am #13928913

mhd-eiadA

Dear Mr. Itmar,
Thank you for your Answers.
I have small questions before close this matter:

 I also solved the missing images from the "Our Products Categories" problem.
How can I deactivate the WPML Media add-on? Please note that I want to use the same images for both languages, so which setting is I should know to do this?

 I also solved the issue with the admin message
YES, This problem also was solved, Thank you

 I can give you a tip regarding the "The direction of the menu on the homepage" issue.
Yes, I understand, it is clear now

By the way, I did not see your screenshots, looks like it was not attached, but any way, the results are clear now, thank you again

Best Regards,
Eiad

July 2, 2023 at 12:02 pm #13929101

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi, Eiad.

You asked: "How can I deactivate the WPML Media add-on? Please note that I want to use the same images for both languages, so which setting is I should know to do this?"

You can deactivate it in Plugins -> All Plugins. You can do it the same way as you deactivate any WordPress plugin. I have already deactivated the WPML Media for you.

The settings that you now have in WPML -> Settings -> Media translation are correct for duplicating the posts for new and existing media.

I can see the screenshots I attached in my previous message. It is weird that you cannot see them. Please see this screenshot.

hidden link

Regards,
Itamar.