StoredStateSetupForProducts
in package
Handles stored state setup for products.
Table of Contents
- ASYNC_RUN_REMOTE_NOTIFICATIONS_ACTION_NAME = 'woocommerce_admin/stored_state_setup_for_products/async/run_remote_notifications'
- admin_init() : mixed
- Initialize the class via the admin_init hook.
- init_stored_state() : object
- Set initial stored state values.
- run_on_product_importer() : mixed
- Runs on product importer steps.
- run_on_transition_post_status() : mixed
- Runs when a post status transitions, but we're only interested if it is a product being published.
- run_remote_notifications() : mixed
- Run the remote notifications engine. This is triggered by action-scheduler after a product is added. It also cleans up from setting the product count increment.
- are_there_products() : bool
- Are there products query.
- update_stored_state_and_possibly_run_remote_notifications() : mixed
- Enqueues an async action (using action-scheduler) to run remote notifications.
Constants
ASYNC_RUN_REMOTE_NOTIFICATIONS_ACTION_NAME
public
mixed
ASYNC_RUN_REMOTE_NOTIFICATIONS_ACTION_NAME
= 'woocommerce_admin/stored_state_setup_for_products/async/run_remote_notifications'
Methods
admin_init()
Initialize the class via the admin_init hook.
public
static admin_init() : mixed
Return values
mixed —init_stored_state()
Set initial stored state values.
public
static init_stored_state(object $stored_state) : object
Parameters
- $stored_state : object
-
The stored state.
Return values
object — The stored state.run_on_product_importer()
Runs on product importer steps.
public
static run_on_product_importer() : mixed
Return values
mixed —run_on_transition_post_status()
Runs when a post status transitions, but we're only interested if it is a product being published.
public
static run_on_transition_post_status(string $new_status, string $old_status, Post $post) : mixed
Parameters
- $new_status : string
-
The new status.
- $old_status : string
-
The old status.
- $post : Post
-
The post.
Return values
mixed —run_remote_notifications()
Run the remote notifications engine. This is triggered by action-scheduler after a product is added. It also cleans up from setting the product count increment.
public
static run_remote_notifications() : mixed
Return values
mixed —are_there_products()
Are there products query.
private
static are_there_products() : bool
Return values
bool —update_stored_state_and_possibly_run_remote_notifications()
Enqueues an async action (using action-scheduler) to run remote notifications.
private
static update_stored_state_and_possibly_run_remote_notifications() : mixed