Product_Update_Listener::meta_updated( int $meta_id, int $post_id, string $meta_key, mixed $meta_value )
Summary
Check if updates to product meta include changes to review count or rating sum
Parameters
- $meta_id
-
(int) (Required) ID of updated metadata entry.
- $post_id
-
(int) (Required) Post ID.
- $meta_key
-
(string) (Required) Meta key.
- $meta_value
-
(mixed) (Required) Meta value.
Source
File: src/BigCommerce/Reviews/Product_Update_Listener.php
public function meta_updated( $meta_id, $post_id, $meta_key, $meta_value ) { if ( ! in_array( $meta_key, [ Product::REVIEW_COUNT_META_KEY, Product::RATING_SUM_META_KEY ], true ) ) { return; } $product_id = get_post_meta( $post_id, Product::BIGCOMMERCE_ID, true ); if ( ! wp_next_scheduled( self::TRIGGER_UPDATE, [ $product_id ] ) ) { wp_schedule_single_event( time(), self::TRIGGER_UPDATE, [ (int) $product_id ] ); } }