WordPress at a glance
function is not described


StoredStateSetupForProducts::run_on_transition_post_status() public WC 1.0

Runs when a post status transitions, but we're only interested if it is a product being published.

{} It's a method of the class: StoredStateSetupForProducts{}

No Hooks.


null. Nothing.


$result = StoredStateSetupForProducts::run_on_transition_post_status( $new_status, $old_status, $post );
$new_status(string) (required)
The new status.
$old_status(string) (required)
The old status.
$post(Post) (required)
The post.

Code of StoredStateSetupForProducts::run_on_transition_post_status() WC 5.3.0

public static function run_on_transition_post_status( $new_status, $old_status, $post ) {
	if (
		'product' !== $post->post_type ||
		'publish' !== $new_status
	) {

	$stored_state                         = RemoteInboxNotificationsEngine::get_stored_state();
	$stored_state->there_are_now_products = true;

	// This is used to increment the product count yielded by the query,
	// which is one less than the actual product count at this point in the
	// product publish lifecycle. This is currently being used by
	// ProductCountRuleProcessor.
	$stored_state->new_product_count = 1;

	RemoteInboxNotificationsEngine::update_stored_state( $stored_state );


	$stored_state->new_product_count = 0;
	RemoteInboxNotificationsEngine::update_stored_state( $stored_state );