*/ protected function input_properties(): array { return array( 'id' => array( 'type' => 'integer', 'description' => __( 'Product id.', 'acrossai-abilities-manager' ) ), 'weight' => array( 'type' => 'string', 'description' => __( 'Weight in the store unit.', 'acrossai-abilities-manager' ) ), 'length' => array( 'type' => 'string', 'description' => __( 'Length.', 'acrossai-abilities-manager' ) ), 'width' => array( 'type' => 'string', 'description' => __( 'Width.', 'acrossai-abilities-manager' ) ), 'height' => array( 'type' => 'string', 'description' => __( 'Height.', 'acrossai-abilities-manager' ) ), 'tax_status' => array( 'type' => 'string', 'description' => __( 'taxable, shipping or none.', 'acrossai-abilities-manager' ) ), 'tax_class' => array( 'type' => 'string', 'description' => __( 'Tax class slug. Empty string for standard.', 'acrossai-abilities-manager' ) ), 'shipping_class_id' => array( 'type' => 'integer', 'description' => __( 'Shipping class term id.', 'acrossai-abilities-manager' ) ), 'featured' => array( 'type' => 'boolean', 'description' => __( 'Whether the product is featured.', 'acrossai-abilities-manager' ) ), 'catalog_visibility' => array( 'type' => 'string', 'description' => __( 'visible, catalog, search or hidden.', 'acrossai-abilities-manager' ) ), 'menu_order' => array( 'type' => 'integer', 'description' => __( 'Ordering within the catalogue.', 'acrossai-abilities-manager' ) ), 'purchase_note' => array( 'type' => 'string', 'description' => __( 'Note shown to the customer after purchase.', 'acrossai-abilities-manager' ) ), 'cross_sell_ids' => array( 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'description' => __( 'Product ids to cross-sell.', 'acrossai-abilities-manager' ) ), 'upsell_ids' => array( 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'description' => __( 'Product ids to upsell.', 'acrossai-abilities-manager' ) ), ); } /** * @since 0.0.34 * @return array */ protected function required_input(): array { return array( 'id' ); } /** * @since 0.0.34 * @return array */ protected function output_properties(): array { return array( 'product' => array( 'type' => 'object', 'additionalProperties' => true ), 'lookup_state' => array( 'type' => 'object', 'additionalProperties' => true ), ); } /** * @since 0.0.34 * @return array */ protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => true, ); } /** * @since 0.0.34 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { $fields = $input; unset( $fields['id'] ); return Product_Repository::update_details( (int) $input['id'], $fields ); } }