Sauter la navigation

Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.

Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.

Marqué : 

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Bruno Kos Il y a 1 année et 4 mois.

Assisté par: Bruno Kos.

Auteur Articles
janvier 30, 2024 à 2:31 pm #15244373

remiB

I try to view/edit an order in the CMS. The client deleted an attribute linked to a product in that order and WPML WooCommerce tries to fetch the product attributes from the order item but it doesn't exists.

lien caché

I should see the order table with all the products in the order.

I have a critical error instead.

The code should be something like this :

private function get_attribute_options( $product_id, $attribute ) {
	$product    = wc_get_product( $product_id );
	$attributes = $product->get_attributes();
	return isset( $attributes[ $attribute ] ) ? $attributes[ $attribute ]->get_options() : [];
}

An error of type E_ERROR was caused in line 274 of the file /home/futondor/www/web/app/plugins/wpml-woocommerce/inc/class-wcml-orders.php. Error message: Uncaught Error: Call to a member function get_options() on null in /home/futondor/www/web/app/plugins/wpml-woocommerce/inc/class-wcml-orders.php:274
Stack trace:
#0 /home/futondor/www/web/app/plugins/wpml-woocommerce/inc/class-wcml-orders.php(291): WCML_Orders->get_attribute_options()
#1 /home/futondor/www/web/app/plugins/wpml-woocommerce/inc/class-wcml-orders.php(216): WCML_Orders->update_attribute_item_meta_value()
#2 /home/futondor/www/web/app/plugins/wpml-woocommerce/inc/class-wcml-orders.php(154): WCML_Orders->adjust_variation_item_if_translated()
#3 /home/futondor/www/web/app/plugins/wpml-woocommerce/inc/class-wcml-orders.php(121): WCML_Orders->adjust_order_item_in_language()
#4 /home/futondor/www/web/wp/wp-includes/class-wp-hook.php(326): WCML_Orders->woocommerce_order_get_items()
#5 /home/futondor/www/web/wp/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#6 /home/futondor/www/web/app/plugins/woocommerce/includes/abstracts/abstract-wc-order.php(888): apply_filters()
#7 /home/futondor/www/web/app/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php(24): WC_Abstract_Order->get_items()
#8 /home/futondor/www/web/app/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-items.php(40): include('...')
#9 /home/futondor/www/web/wp/wp-admin/includes/template.php(1456): WC_Meta_Box_Order_Items::output()
#10 /home/futondor/www/web/wp/wp-admin/edit-form-advanced.php(714): do_meta_boxes()
#11 /home/futondor/www/web/wp/wp-admin/post.php(206): require('...')
#12 {main}
thrown

janvier 31, 2024 à 6:58 am #15247366

Bruno Kos
Partisan de WPML depuis 12/2018

Les langues: Anglais (English ) Allemand (Deutsch ) Français (Français )

Fuseau horaire: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

I tried to reproduce on my localhost but I get no error. I did this:

- 2 languages
- attribute with 2 terms translated to 2 languages
- created variable product with this attribute, translated it and made orders in both languages
- deleted attribute and its terms from both languages

But when I check both orders they still show.

Can you give me steps to reproduce?

Regards,
Bruno Kos