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.

This topic contains 1 reply, has 1 voice.

Last updated by davidR-5 1 year, 9 months ago.

Author Posts
June 27, 2022 at 6:19 pm #11554011

davidR-5

I installed a vanilla WP, WooCommerce, WooCommerce Subscriptions. I am testing multicurrency.

I created 2 currencies: USD and EUR.
I created 1 variable product and 2 variations.
I set the prices manually.

I am testing as a customer, I buy a subscription, during checkout I have the default location US I see USD. I change the location to Italy, I expect to see the EUR pricing, instead there's a fatal error:

web-store-wordlift-io-wordpress-1  | 2022/06/27 17:58:27 [error] 636#636: *1634 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string * int in /bitnami/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php:2032
web-store-wordlift-io-wordpress-1  | Stack trace:
web-store-wordlift-io-wordpress-1  | #0 /bitnami/wordpress/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php(711): WC_Cart->get_product_subtotal()
web-store-wordlift-io-wordpress-1  | #1 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(307): WC_Subscriptions_Cart::get_formatted_product_subtotal()
web-store-wordlift-io-wordpress-1  | #2 /opt/bitnami/wordpress/wp-includes/plugin.php(191): WP_Hook->apply_filters()
web-store-wordlift-io-wordpress-1  | #3 /bitnami/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php(2036): apply_filters()
web-store-wordlift-io-wordpress-1  | #4 /bitnami/wordpress/wp-content/plugins/woocommerce/templates/checkout/review-order.php(43): WC_Cart->get_product_subtotal()
web-store-wordlift-io-wordpress-1  | #5 /bitnami/wordpress/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('...')
web-store-wordlift-io-wordpress-1  | #6 /bitnami/wordpress/wp-content/plugins/woocommerce/includes/wc-template-functions.php(2321): wc_get_template()
web-store-wordlift-io-wordpress-1  | #7" while reading response header from upstream, client: 192.168.224.4, server: _, request: "GET /checkout/?XDEBUG_SESSION HTTP/1.0", upstream: "<em><u>hidden link</u></em>:", host: "wordpress:8080"

I have xdebug enabled I could see that the issue arises in this function:

	protected function get_prop( $prop, $context = 'view' ) {
		$value = null;

		if ( array_key_exists( $prop, $this->data ) ) {
			$value = array_key_exists( $prop, $this->changes ) ? $this->changes[ $prop ] : $this->data[ $prop ];

			if ( 'view' === $context ) {
				$value = apply_filters( $this->get_hook_prefix() . $prop, $value, $this );
				^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
			}
		}

		return $value;
	}

A filter is resetting the custom pricing to an empty string.

June 27, 2022 at 6:28 pm #11554025

davidR-5

I found the issue. In the product variation, when I manually set the EUR pricing, there's a field: "Sign-up fee".

I didn't populate this field. By default it is an empty field.

In future WPML for WooCommerce versions, I would suggest to preset it to 0 by default (like WooCommerce does), or mark it required.

Cheers,
David

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.