'WooCommerce get product type after save
Can you please tell me how can I get product type after product save?
add_action( 'save_post_product', 'nd_update_group_product_attributes_func', 1001, 3 );
function nd_update_group_product_attributes_func($post_ID, $post, $update)
{
if($post->post_type == 'product'){
$childrens = $post->get_children();
$product_type = $post->get_type(); /* this will return simple for all product type*/
}
}
Even I have "grouped" product type. $product_type = $post->get_type(); on save_post_product hook will return the "simple" when we first create the product and later on update will return "grouped".
Solution 1:[1]
if( $_product->is_type( 'simple' ) ) $product->is_type( 'variable' )
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | joanna kowalska |
