>get_contextual_fields_for_location( 'contact', $document_object ); $additional_fields = array_merge( $additional_fields_order, $additional_fields_contact ); } else { $additional_fields_order = $this->additional_fields_controller->get_fields_for_location( 'order' ); $additional_fields_contact = $this->additional_fields_controller->get_fields_for_location( 'contact' ); $additional_fields = array_merge( $additional_fields_order, $additional_fields_contact ); } $field_values = (array) $request['additional_fields'] ?? []; foreach ( $additional_fields as $key => $field ) { if ( isset( $field_values[ $key ] ) ) { $this->additional_fields_controller->persist_field_for_order( $key, $field_values[ $key ], $this->order, 'other', false ); } } // We need to sync the customer additional fields with the order otherwise they will be overwritten on next page load. if ( 0 !== $this->order->get_customer_id() && get_current_user_id() === $this->order->get_customer_id() ) { $customer = new WC_Customer( $this->order->get_customer_id() ); $this->additional_fields_controller->sync_customer_additional_fields_with_order( $this->order, $customer ); $customer->save(); } } /** * Returns a document object from a REST request. * * @param \WP_REST_Request $request The REST request. * @return DocumentObject The document object or null if experimental blocks are not enabled. */ public function get_document_object_from_rest_request( \WP_REST_Request $request ) { return new DocumentObject( [ 'customer' => [ 'billing_address' => $request['billing_address'], 'shipping_address' => $request['shipping_address'], 'additional_fields' => array_intersect_key( $request['additional_fields'] ?? [], array_flip( $this->additional_fields_controller->get_contact_fields_keys() ) ), ], 'checkout' => [ 'payment_method' => $request['payment_method'], 'create_account' => $request['create_account'], 'customer_note' => $request['customer_note'], 'additional_fields' => array_intersect_key( $request['additional_fields'] ?? [], array_flip( $this->additional_fields_controller->get_order_fields_keys() ) ), ], ] ); } }
Fatal error: Trait 'Automattic\WooCommerce\StoreApi\Utilities\CheckoutTrait' not found in /home/htzanetatos/public_html/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php on line 17