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

WC_Product_Variable::save() public WC 3.0.0

Save data (either create or update depending on if we are working on an existing product).

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

Возвращает

null. Ничего.

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

$WC_Product_Variable = new WC_Product_Variable();
$WC_Product_Variable->save();

Список изменений

С версии 3.0.0 Введена.

Код WC_Product_Variable::save() WC 5.4.1

<?php
public function save() {
	$this->validate_props();

	if ( ! $this->data_store ) {
		return $this->get_id();
	}

	/**
	 * Trigger action before saving to the DB. Allows you to adjust object props before save.
	 *
	 * @param WC_Data          $this The object being saved.
	 * @param WC_Data_Store_WP $data_store The data store persisting the data.
	 */
	do_action( 'woocommerce_before_' . $this->object_type . '_object_save', $this, $this->data_store );

	// Get names before save.
	$previous_name = $this->data['name'];
	$new_name      = $this->get_name( 'edit' );

	if ( $this->get_id() ) {
		$this->data_store->update( $this );
	} else {
		$this->data_store->create( $this );
	}

	$this->data_store->sync_variation_names( $this, $previous_name, $new_name );
	$this->data_store->sync_managed_variation_stock_status( $this );

	/**
	 * Trigger action after saving to the DB.
	 *
	 * @param WC_Data          $this The object being saved.
	 * @param WC_Data_Store_WP $data_store The data store persisting the data.
	 */
	do_action( 'woocommerce_after_' . $this->object_type . '_object_save', $this, $this->data_store );

	return $this->get_id();
}