You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing a massive issue which is only facing inside a subscription order. When reproducing this issue inside a normal WooCommerce order, everything works as expected.
As a plugin developer, I'm always trying to make good compatibility. In my case, my plugin sets a custom meta to a WooCommerce order or subscription, depending on if it's a normal order or subscription:
This works as expected and documented inside the WooCommerce developer documentation:
When I now press the “Assign license” button (which just triggers the form submit with an additional hidden field), a script runs within the following hook which does some things. At the end, the custom meta should be deleted. This works fine inside any normal order, but inside a subscription, nothing happens. The meta is still there (normal posts table and HPOS). It was working before the version 6.0.0 but since the update, I'm no longer able to delete any custom meta:
add_action( 'woocommerce_update_order', array( $this, 'woocommerce_update_order_action' ), 99, 3 );
public function woocommerce_update_order_action( int $order_id, WC_Order $order ): void {
foreach ( $order->get_items() as $order_item ) {
$order_item->delete_meta_data( '_elm_license_id' );
$order_item->save();
}
}
To Reproduce
Use the above hooks to set a custom meta when creating an order / subscription
Use the 2nd snippet to delete the meta again when pressing the “Update” button inside a subscription
Expected behavior
The custom meta should be gone.
Actual behavior
The custom meta is still there.
Product impact
[yes ] Does this issue affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[no] Does this issue affect WooCommerce Payments? yes/no/tbc, add issue ref
The text was updated successfully, but these errors were encountered:
Describe the bug
I am facing a massive issue which is only facing inside a subscription order. When reproducing this issue inside a normal WooCommerce order, everything works as expected.
As a plugin developer, I'm always trying to make good compatibility. In my case, my plugin sets a custom meta to a WooCommerce order or subscription, depending on if it's a normal order or subscription:
This works as expected and documented inside the WooCommerce developer documentation:
When I now press the “Assign license” button (which just triggers the form submit with an additional hidden field), a script runs within the following hook which does some things. At the end, the custom meta should be deleted. This works fine inside any normal order, but inside a subscription, nothing happens. The meta is still there (normal posts table and HPOS). It was working before the version 6.0.0 but since the update, I'm no longer able to delete any custom meta:
To Reproduce
Expected behavior
The custom meta should be gone.
Actual behavior
The custom meta is still there.
Product impact
The text was updated successfully, but these errors were encountered: