Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::set_order_prop()privateWC 1.0

Set order prop if a setter exists in either the order object or in the data store.

Method of the class: OrdersTableDataStore{}

No Hooks.

Return

true|false. True if the property was set, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->set_order_prop( $order, $prop_name, $prop_value );
$order(\WC_Abstract_Order) (required)
Order object.
$prop_name(string) (required)
Property name.
$prop_value(mixed) (required)
Property value.

OrdersTableDataStore::set_order_prop() code WC 7.1.0

private function set_order_prop( \WC_Abstract_Order $order, string $prop_name, $prop_value ) {
	$prop_setter_function_name = "set_{$prop_name}";
	if ( is_callable( array( $order, $prop_setter_function_name ) ) ) {
		return $order->{$prop_setter_function_name}( $prop_value );
	} elseif ( is_callable( array( $this, $prop_setter_function_name ) ) ) {
		return $this->{$prop_setter_function_name}( $order, $prop_value, false );
	}
	return false;
}