# woocommerce-pos/1.10.19/includes/Interfaces/Collection_Writer_Interface.php

WCPOS – Point of Sale (POS) plugin for WooCommerce, version 1.10.19. 64 lines.

- Page: https://pluginprobe.com/plugins/woocommerce-pos/1.10.19/code/includes/Interfaces/Collection_Writer_Interface.php
- Raw: https://pluginprobe.com/plugins/woocommerce-pos/1.10.19/raw/includes/Interfaces/Collection_Writer_Interface.php
- Modified: 2026-09-19T05:33:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woocommerce-pos/1.10.19/code/includes/Interfaces/Collection_Writer_Interface.php#L10-L20`.

```php
<?php
/**
 * Collection writer lifecycle contract.
 *
 * @package WCPOS\WooCommercePOS\Interfaces
 */

// phpcs:disable Squiz.Commenting, Generic.Commenting -- Lifecycle docblocks are intentionally concise.

namespace WCPOS\WooCommercePOS\Interfaces;

/**
 * Adapts collection behavior around the controller-owned mutation protocol.
 *
 * @internal Not a public extension point. Unlike the other contracts in this
 * namespace, this shape is provisional: six of its methods still take a
 * `callable` for the controller's default implementation, and the intended
 * follow-up is to push those defaults into Null_Writer and let the other
 * writers extend it. Third-party code must not implement this interface —
 * narrowing it later would otherwise be a breaking change on a released line.
 */
interface Collection_Writer_Interface {
	/**
	 * Prepare a create payload and route.
	 *
	 * @return array|object Prepared write with method, route, payload, context, and optional context_factory keys; or validation error.
	 */
	public function prepare_create( array $meta, array $payload, callable $validate_tax_ids );

	/**
	 * Prepare an update payload and route.
	 *
	 * @return array|object Prepared write with method, route, payload, context, and optional context_factory keys; or validation error.
	 */
	public function prepare_update( array $meta, int $id, array $payload, callable $validate_tax_ids );

	/** Validate and repair an already-existing create target. */
	public function validate_existing_create( int $id, array $payload, array $prepared );

	/** Forward a prepared write within collection hooks. */
	public function forward( array $prepared, callable $forward );

	/** After the wc/v3 create returned an id, before the client UUID is proven on it. */
	public function after_create( int $id, array $payload ): void;

	/** After the client UUID is proven on the created record, before the mutation is finalized. */
	public function after_identity( int $id, array $payload ): void;

	/** On a retry that re-proves a poisoned create's identity, before it is finalized. */
	public function after_recovery( int $id, array $payload ): void;

	/** After a wc/v3 update succeeded, before the mutation is finalized. */
	public function after_update( int $id, array $payload, array $current, array $response_data, array $context ): void;

	/** Execute the collection-specific delete forward. */
	public function delete( array $meta, int $id, array $mutation, callable $dispatch, callable $can_delete );

	/** Read the collection's authoritative response document. */
	public function document( array $meta, int $id, callable $default_document );

	/** Shape a bare document for the mutation response. */
	public function build_response_document( array $bare, string $record_id, array $meta, int $id, callable $default_builder ): array;
}

```
