Hi,
I would like to report deprecation notices in PHP 8.3 that I have traced to your WpmlSavePostHooks::on_product_save() method. The background is that I am trying to maintain a third-party plugin that deals with WooCommerce inventory management. It makes AJAX calls to update various inventory things. For example, to update manage stock status, it follows the WC approved method:
$product = wc_get_product( $id );
$product->set_manage_stock( $manage );
$product->save();
But now with PHP 8.3, we are getting deprecation notices:
[03-Jul-2026 16:22:03 UTC] PHP Deprecated: Creation of dynamic property WC_Product_Simple::$ID is deprecated in […]/wp-includes/post.php on line 2934
[03-Jul-2026 16:22:03 UTC] PHP Deprecated: Creation of dynamic property WC_Product_Simple::$filter is deprecated in […]/wp-includes/post.php on line 2939
This seems to happen because, when we save the product, the woocommerce_after_product_object_save hook fires, into which WPML hooks its WpmlSavePostHooks::on_product_save( $post ) method (in plugins/sitepress-multilingual-cms/classes/hooks/WpmlSavePostHooks.php). The woocommerce_after_product_object_save is fired with WC_Product object as the first argument, which the on_product_save() method tries to immediately pass into get_post().
There is the problem, because get_post() is expecting either a post ID as an integer or a WP_Post object. Instead it gets a WC_Product object, which it tries to fix with sanitize_post(). A WC_Product object does not have a public $ID property, so sanitize_post() tries to set one in the old deprecated way.
Adding the following to the top of on_product_save() seems to resolve the issue in my testing, but I won't presume to understand the inner workings of your rather complex plugin. But in case it is helpful:
if ( $post instanceof \WC_Product ) {
$post = $post->get_id();
}
Thank you for looking into this. I am not expecting an immediate fix: it's just a deprecation notice on dev copies of the site, so we can overlook it for now and move on.
WordPress 6.9.4
PHP 8.3
WPML Multilingual CMS 4.9.5
WPML Multilingual & Multicurrency for WooCommerce 5.5.6