@rolfhuiber ,
Would like to update you that currently Smart Manager won’t trigger woocommerce_admin_process_product_object hook when updating the product.
We have taken a note of the same and will surely update you once support for the same is added.
Alternatively, currently Smart Manager plugin has sm_inline_update_pre filter using which you can write a custom code and trigger the same hook.
I looked into the hook you suggested. As it has been some time ago and I haven’t picked it up again, when I am not mistaken, the provided $edited_data does not contain a product_id (product_id of the (newly created) variation). Or does it?
Currently I run the WooCommerce product edit to publish, which runs the WooCommerce hook.
@rolfhuiber ,
Would like to update you that $edited_data array will have product variation id when updating the existing variable product.
Please try to use sm_inline_update_pre custom filter and let us know your views on the same.
The code run from the WooCommerce hook does the following:
if product is “variable”
get children (variations)
for each child
get length of the variable product (get_attributes)
adapt SKU: based on variable product SKU + length
The code expects the SKU of the variable product already to be saved.
sm_inline_update_pre is run before the edited data is saved in the DB.
The product_id I get from your hook, I checked that before, so just have to get the $product and call my code (which worked in a mock).
Can you please implement a similar hook which is run after the edited data is saved.
@rolfhuiber ,
Thank you for getting back to us.
Would like to update you that the Smart Manager plugin has a sm_inline_update_post custom action which is fired after data is saved in the database and also after sm_inline_update_pre custom filter.
Request you to try using the above custom action and do let us know your views.
sm_inline_update_post worked, thanks for your help.
@rolfhuiber ,
You’re welcome 🙂