WordPress at Your Fingertips
function is not described

WC_REST_CRUD_Controller::prepare_object_for_database() protected WC 3.0.0

Prepares one object for create or update operation.

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

No Hooks.


WP_Error|WC_Data. The prepared item, or WP_Error object on failure.


// protected - for code of main (parent) or child class
$result = $this->prepare_object_for_database( $request, $creating );
$request(WP_REST_Request) (required)
Request object.
If is creating a new object.
Default: false


Since 3.0.0 Introduced.

Code of WC_REST_CRUD_Controller::prepare_object_for_database() WC 5.9.0

protected function prepare_object_for_database( $request, $creating = false ) {
	// translators: %s: Class method name.
	return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );