Answer the question
In order to leave comments, you need to log in
When updating or creating a specific post type, how do I update all WooCommerce products?
When you update the custom post type "group_products", you need to update all WooCommerce products automatically.
Like how to click on the "Update" button only for all products and automatically.
I think that you can do something with save_post but the link does not work like if save_post_group_products, save_post_products. Tipo xs tell me what can be done?
Answer the question
In order to leave comments, you need to log in
I don't really understand what the link is.
Should work like this (if WP version 3.7 or higher)
add_action( 'save_post_group_products', 'my_save_post' );
function my_save_post( $post_id ) {
// 7 - это ID товара
// Если хотите обновить все товары и товаров немного, то можно, например, запросить их через WP_Query и обновить циклом.
wp_update_post( array( 'ID' => 7, 'post_status' => 'private' ) );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question