WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Admin_Post_Types::quick_edit_save() private WC 1.0

Quick edit.

Это метод класса: WC_Admin_Post_Types{}

Хуки из метода
Возвращает

Null. Ничего.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->quick_edit_save( $post_id, $product );
$post_id(число) (обязательный)
Post ID being saved.
$product(WC_Product) (обязательный)
Product object.

Код WC_Admin_Post_Types::quick_edit_save() WC 4.5.2

woocommerce/includes/admin/class-wc-admin-post-types.php
<?php
private function quick_edit_save( $post_id, $product ) {
	$request_data = $this->request_data();

	$data_store        = $product->get_data_store();
	$old_regular_price = $product->get_regular_price();
	$old_sale_price    = $product->get_sale_price();
	$input_to_props    = array(
		'_weight'     => 'weight',
		'_length'     => 'length',
		'_width'      => 'width',
		'_height'     => 'height',
		'_visibility' => 'catalog_visibility',
		'_tax_class'  => 'tax_class',
		'_tax_status' => 'tax_status',
	);

	foreach ( $input_to_props as $input_var => $prop ) {
		if ( isset( $request_data[ $input_var ] ) ) {
			$product->{"set_{$prop}"}( wc_clean( wp_unslash( $request_data[ $input_var ] ) ) );
		}
	}

	if ( isset( $request_data['_sku'] ) ) {
		$sku = $product->get_sku();
		// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
		$new_sku = (string) wc_clean( $request_data['_sku'] );

		if ( $new_sku !== $sku ) {
			if ( ! empty( $new_sku ) ) {
				$unique_sku = wc_product_has_unique_sku( $post_id, $new_sku );
				if ( $unique_sku ) {
					$product->set_sku( wc_clean( wp_unslash( $new_sku ) ) );
				}
			} else {
				$product->set_sku( '' );
			}
		}
	}

	if ( ! empty( $request_data['_shipping_class'] ) ) {
		if ( '_no_shipping_class' === $request_data['_shipping_class'] ) {
			$product->set_shipping_class_id( 0 );
		} else {
			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
			$shipping_class_id = $data_store->get_shipping_class_id_by_slug( wc_clean( $request_data['_shipping_class'] ) );
			$product->set_shipping_class_id( $shipping_class_id );
		}
	}

	$product->set_featured( isset( $request_data['_featured'] ) );

	if ( $product->is_type( 'simple' ) || $product->is_type( 'external' ) ) {

		if ( isset( $request_data['_regular_price'] ) ) {
			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
			$new_regular_price = ( '' === $request_data['_regular_price'] ) ? '' : wc_format_decimal( $request_data['_regular_price'] );
			$product->set_regular_price( $new_regular_price );
		} else {
			$new_regular_price = null;
		}
		if ( isset( $request_data['_sale_price'] ) ) {
			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
			$new_sale_price = ( '' === $request_data['_sale_price'] ) ? '' : wc_format_decimal( $request_data['_sale_price'] );
			$product->set_sale_price( $new_sale_price );
		} else {
			$new_sale_price = null;
		}

		// Handle price - remove dates and set to lowest.
		$price_changed = false;

		if ( ! is_null( $new_regular_price ) && $new_regular_price !== $old_regular_price ) {
			$price_changed = true;
		} elseif ( ! is_null( $new_sale_price ) && $new_sale_price !== $old_sale_price ) {
			$price_changed = true;
		}

		if ( $price_changed ) {
			$product->set_date_on_sale_to( '' );
			$product->set_date_on_sale_from( '' );
		}
	}

	// Handle Stock Data.
	// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
	$manage_stock = ! empty( $request_data['_manage_stock'] ) && 'grouped' !== $product->get_type() ? 'yes' : 'no';
	$backorders   = ! empty( $request_data['_backorders'] ) ? wc_clean( $request_data['_backorders'] ) : 'no';
	if ( ! empty( $request_data['_stock_status'] ) ) {
		$stock_status = wc_clean( $request_data['_stock_status'] );
	} else {
		$stock_status = $product->is_type( 'variable' ) ? null : 'instock';
	}
	// phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

	$product->set_manage_stock( $manage_stock );
	$product->set_backorders( $backorders );

	if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
		$stock_amount = 'yes' === $manage_stock && isset( $request_data['_stock'] ) && is_numeric( wp_unslash( $request_data['_stock'] ) ) ? wc_stock_amount( wp_unslash( $request_data['_stock'] ) ) : '';
		$product->set_stock_quantity( $stock_amount );
	}

	$product = $this->maybe_update_stock_status( $product, $stock_status );

	$product->save();

	do_action( 'woocommerce_product_quick_edit_save', $product );
}