Automattic\WooCommerce\StoreApi\Schemas
ExtendSchema::register_update_callback()
Add callback functions that can be executed by the cart/extensions endpoint.
Method of the class: ExtendSchema{}
No Hooks.
Return
null
. Nothing (null).
Usage
$ExtendSchema = new ExtendSchema(); $ExtendSchema->register_update_callback( $args );
- $args(array) (required)
An array of elements that make up the callback configuration.
-
namespace(string)
Required. Plugin namespace. - callback(callable)
Required. The function/callable to execute.
-
ExtendSchema::register_update_callback() ExtendSchema::register update callback code WC 9.5.1
public function register_update_callback( $args ) { $args = wp_parse_args( $args, [ 'namespace' => '', 'callback' => null, ] ); if ( ! is_string( $args['namespace'] ) || empty( $args['namespace'] ) ) { throw new \Exception( 'You must provide a plugin namespace when extending a Store REST endpoint.' ); } if ( ! is_callable( $args['callback'] ) ) { throw new \Exception( 'There is no valid callback supplied to register_update_callback.' ); } $this->callback_methods[ $args['namespace'] ] = $args; }