WC_Meta_Box_Product_Images::save()public staticWC 1.0

Save meta box data.

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

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Meta_Box_Product_Images::save( $post_id, $post );
$post_id(int) (required)
-
$post(WP_Post) (required)
-

Code of WC_Meta_Box_Product_Images::save() WC 6.7.0

public static function save( $post_id, $post ) {
	$product_type   = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) );
	$classname      = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
	$product        = new $classname( $post_id );
	$attachment_ids = isset( $_POST['product_image_gallery'] ) ? array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) ) : array();

	$product->set_gallery_image_ids( $attachment_ids );
	$product->save();
}