PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.20
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.20
1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 All 164 releases
← All changes | includes/API/V2/Writers/Customer_Writer.php +18 -3 1.10.4 → 1.10.20 View file →
@@ -25,11 +25,26 @@
25 25 $error = $validate_tax_ids( $payload );
26 26 return is_wp_error( $error ) ? $error : parent::prepare_update( $meta, $id, $this->prepare_payload( $payload ), $validate_tax_ids );
27 27 }
28 28
29 - /** Persist customer tax IDs after successful writes and poison recovery. */
30 - public function persist( string $phase, int $id, array $payload, array $current = array(), array $response_data = array(), array $context = array() ): void {
31 - if ( ! in_array( $phase, array( 'create_before_identity', 'create_recovery', 'update' ), true ) || $id <= 0 || ! is_array( $payload['tax_ids'] ?? null ) ) {
29 + /** Persist customer tax IDs after create. */
30 + public function after_create( int $id, array $payload ): void {
31 + $this->write_tax_ids( $id, $payload );
32 + }
33 +
34 + /** Persist customer tax IDs after recovery. */
35 + public function after_recovery( int $id, array $payload ): void {
36 + $this->write_tax_ids( $id, $payload );
37 + }
38 +
39 + /** Persist customer tax IDs after update. */
40 + public function after_update( int $id, array $payload, array $current, array $response_data, array $context ): void {
41 + $this->write_tax_ids( $id, $payload );
42 + }
43 +
44 + /** The one tax-ID write every lifecycle phase shares; identity itself never carries tax ids. */
45 + private function write_tax_ids( int $id, array $payload ): void {
46 + if ( $id <= 0 || ! is_array( $payload['tax_ids'] ?? null ) ) {
32 47 return;
33 48 }
34 49 ( new Tax_Id_Writer() )->write_for_user( $id, $payload['tax_ids'] );
35 50 }