If you are having a notice about writing the .mo files please read this doc

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 thread is resolved. Here is a description of the problem and solution.

Problem: Error received on undefined index varations when attempting to use the Woocommerce Dynamic pricing plugin Solution: Update all WPML plugins

Relevant Documentation: NA

This topic contains 9 replies, has 2 voices.

Last updated by jouniK 1 year, 9 months ago.

Assigned support staff: Yvette.

Author Posts
January 30, 2018 at 7:40 pm #1502141

jouniK

I am trying to:
Get rid of error on my page.

Link to a page where the issue can be seen:
https://wpml.org/forums/topic/php-warning-on-the-translated-product-page-notice-undefined-index-variations-i/

I expected to see:
No errors.

Instead, I got:
Problem still exists. The same errors appear as on ticket provided above. Previous customer never replied as solved. Previous solution provided was:
"From the notice message, it looks like the variations are empty in the secondary language. Have you translated the variations/attributes? If yes, after saving/publishing this translated product page, does the problem persist?"

I did all that and error messages are still there.

January 30, 2018 at 9:44 pm #1502224

jouniK

I narrowed done the problem. The problem occurs on variable products.
on file: /plugins/woocommerce-multilingual/compatibility/class-wcml-dynamic-pricing.php on line 132
There is a loop to check trough pricing rules from array

if ( array_key_exists( 'variation_rules', $rule ) ) {
	foreach ( $rule['variation_rules']['args']['variations'] as $i => $variation_id ) {
		$rules[ $r_key ]['variation_rules']['args']['variations'][ $i ] = apply_filters( 'translate_object_id', $variation_id, 'product_variation', true );
	}
}

. From Dynamic Pricing plugin you can specify pricing rules for the product with an option "All variations" and you can choose "Specific variations". When you specify variations, there will be

['variations']

array and errors are not shown. If you choose "All variations", class-wcml-dynamic-pricing.php on line 132, will still search for variations array even if it doesn't exist. Can you add some conditional there to fix the problem?

January 31, 2018 at 6:14 am #1502368

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hello

Thanks for bringing this to our attention. I will be able to escalate this issue to our compatibiltiy team and programmers if I am able to reproduce this problem on a fresh install of the version of Dynamic Pricing that you are using.

We have tested this plugin up to version 3.1.2

1. What version of the plugin are you using?
If it is a later version, please send me a zip copy of the plugin in your reply. I am opening the private area for this. You should send me a link to a filesharing platform where you have previously uploaded the zip. Use a service like Dropbox, Fileshare, WeTransfer...etc

2. Technical Information on you environment
Could you please provide information about your environment by following thsese steps: http://wpml.org/faq/provide-debug-information-faster-support/

3. I understand from what you wrote, to recreate the probem I should install the plugin and then create a pricing rules for a product using the option "All variations"

Is this correct?

Thanks for providing the requested info and zip file.

February 4, 2018 at 6:13 pm #1506499

jouniK

Any updates? Is there something I could do?

February 5, 2018 at 12:50 pm #1507111

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hello

I´m sory for the delay in responding. I´ve been trying to replicate this issue on a fresh install with the plugin you provided but have not been successful.

Please see the images attached.

I installed the plugin and applied a new price group to a variable product.
At checkout, the discount is applied in both the primary and secondary language carts.

Have I missed something in the discount definition?

February 6, 2018 at 8:16 pm #1509142

jouniK

I figured out that the problem occurs only when I have both WPML string translation and WPML translation management plugins activated. Everything works as expected and as your screenshots if I deactivate translation management.

I have tried removing all the translation for a specific product with no luck.

My currently active plugins are in screenshot.

February 7, 2018 at 8:46 am #1509540

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Have you tried to test with all other non-WPML plugins deactivated. If you are finding that only TM is causing the problem, this suggests a plugin incompatibility.

Please find a moment to deactivate all non-WPML plugins except for Woocommerce and also temporariy change your active theme to Twenty Seventeen.

Then, check if the problem still occurs.

If it does not, change the theme back to your regular theme, and begin activating the non-WPML plugins one-by-one until your are seeing the same problem again.

This would be the plugin we need to focus on.

Thank you.

February 7, 2018 at 6:58 pm #1510499

jouniK

"Please find a moment to deactivate all non-WPML plugins except for Woocommerce and also temporariy change your active theme to Twenty Seventeen."

As seen from the screenshot above, and I also tried activating twenty seventeen, errors are still present - so only non-WPML plugins that I have activated are Woocommerce and Woocommerce dynamic pricing (on which the problem occurs).

February 7, 2018 at 9:23 pm #1510646

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Sorry, I did not realise that you had deactivated all of your other plugins. Your installation information shows 39 plugins are installed and these were not visible in the screenshot you provided.

If you have deactivated all 33 plugins (39 - WPML modules - Woocommerce) then this is the same setup that I had in my local installation except that all my plugins were at the latest releases (including WPML and Woocommerce)

Can you please upgrade all of your WPML and Woocommerce plugins to the latest releases and then deactivate your 33 non-WPML plugins and try again?

If you still have the problem, then I would like to take a snapshot of your site and install it on my local server to see if I get the same result. But before I do this, please upgrade your plugins and try one more time.

I am opening the private area in case you are still having the problem and I need to take a snapshot. Please install the Duplicator plugin for this step.

February 12, 2018 at 9:47 pm #1515451

jouniK

The problem was fixed by updating all WPML plugins. Thanks.