From 793ea2ed41df507226d5168dbc0a20fcfc4837a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alda=20Vigd=C3=ADs=20Skarph=C3=A9=C3=B0insd=C3=B3ttir?= Date: Thu, 7 Mar 2024 13:21:49 +0100 Subject: [PATCH] Updating docblocks --- src/WooMetaboxes.php | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/WooMetaboxes.php b/src/WooMetaboxes.php index ef786be..ab54d9e 100644 --- a/src/WooMetaboxes.php +++ b/src/WooMetaboxes.php @@ -22,13 +22,14 @@ public function __construct() { add_action( 'woocommerce_product_options_sku', - array( __CLASS__, 'render_product_options_sku_partial' ) + array( $this, 'render_product_options_sku_partial' ) ); add_action( 'save_post_product', - array( __CLASS__, 'save_product_meta' ), - 10 + array( $this, 'save_product_meta' ), + 10, + 1 ); } @@ -49,12 +50,24 @@ public static function render_product_options_sku_partial(): void { require __DIR__ . '/../views/product_options_sku_partial.php'; } - public static function save_product_meta( $id ): void { - self::save_price_sync_meta( $id ); - self::save_stock_sync_meta( $id ); + /** + * Save the NineteenEightyWoo related meta tags for a product using superglobals + * + * Fired during the `save_post_product` hook. + * + * @param int $id The post ID for the product. + */ + public function save_product_meta( int $id ): void { + $this->save_price_sync_meta( $id ); + $this->save_stock_sync_meta( $id ); } - public static function save_price_sync_meta( $id ) { + /** + * Save the 1984_woo_dk_price_sync post meta from superglobals + * + * @param int $id The post ID for the product. + */ + public function save_price_sync_meta( int $id ): void { if ( false === isset( $_POST['set_1984_woo_dk_price_sync_nonce'] ) ) { return; } @@ -76,7 +89,12 @@ public static function save_price_sync_meta( $id ) { } } - public static function save_stock_sync_meta( $id ) { + /** + * Save the 1984_woo_dk_stock_sync post meta from superglobal + * + * @param int $id The post ID for the product. + */ + public function save_stock_sync_meta( int $id ): void { if ( false === isset( $_POST['set_1984_woo_dk_stock_sync_nonce'] ) ) { return; }