on get_route_post_response( \WP_REST_Request $request ) { $cart = $this->cart_controller->get_cart_instance(); $customer = wc()->customer; // Get data from request object and merge with customer object, then sanitize. $billing = $this->schema->billing_address_schema->sanitize_callback( wp_parse_args( $request['billing_address'] ?? [], $this->get_customer_billing_address( $customer ) ), $request, 'billing_address' ); $shipping = $this->schema->billing_address_schema->sanitize_callback( wp_parse_args( $request['shipping_address'] ?? [], $this->get_customer_shipping_address( $customer ) ), $request, 'shipping_address' ); // If the cart does not need shipping, shipping address is forced to match billing address unless defined. if ( ! $cart->needs_shipping() && ! isset( $request['shipping_address'] ) ) { $shipping = $billing; } // Run validation and sanitization now that the cart and customer data is loaded. $billing = $this->schema->billing_address_schema->sanitize_callback( $billing, $request, 'billing_address' ); $shipping = $this->schema->shipping_address_schema->sanitize_callback( $shipping, $request, 'shipping_address' ); // Validate data now everything is clean.. $validation_check = $this->validate_address_params( $request, $billing, $shipping ); if ( is_wp_error( $validation_check ) ) { return rest_ensure_response( $validation_check ); } $customer->set_props( array( 'billing_first_name' => $billing['first_name'] ?? null, 'billing_last_name' => $billing['last_name'] ?? null, 'billing_company' => $billing['company'] ?? null, 'billing_address_1' => $billing['address_1'] ?? null, 'billing_address_2' => $billing['address_2'] ?? null, 'billing_city' => $billing['city'] ?? null, 'billing_state' => $billing['state'] ?? null, 'billing_postcode' => $billing['postcode'] ?? null, 'billing_country' => $billing['country'] ?? null, 'billing_phone' => $billing['phone'] ?? null, 'billing_email' => $billing['email'] ?? null, 'shipping_first_name' => $shipping['first_name'] ?? null, 'shipping_last_name' => $shipping['last_name'] ?? null, 'shipping_company' => $shipping['company'] ?? null, 'shipping_address_1' => $shipping['address_1'] ?? null, 'shipping_address_2' => $shipping['address_2'] ?? null, 'shipping_city' => $shipping['city'] ?? null, 'shipping_state' => $shipping['state'] ?? null, 'shipping_postcode' => $shipping['postcode'] ?? null, 'shipping_country' => $shipping['country'] ?? null, 'shipping_phone' => $shipping['phone'] ?? null, ) ); // We want to only get additional fields passed, since core ones are already saved. $core_fields = array_keys( $this->additional_fields_controller->get_core_fields() ); $additional_shipping_values = array_diff_key( $shipping, array_flip( $core_fields ) ); $additional_billing_values = array_diff_key( $billing, array_flip( $core_fields ) ); // We save them one by one, and we add the group prefix. foreach ( $additional_shipping_values as $key => $value ) { $this->additional_fields_controller->persist_field_for_customer( $key, $value, $customer, 'shipping' ); } foreach ( $additional_billing_values as $key => $value ) { $this->additional_fields_controller->persist_field_for_customer( $key, $value, $customer, 'billing' ); } wc_do_deprecated_action( 'woocommerce_blocks_cart_update_customer_from_request', array( $customer, $request, ), '7.2.0', 'woocommerce_store_api_cart_update_customer_from_request', 'This action was deprecated in WooCommerce Blocks version 7.2.0. Please use woocommerce_store_api_cart_update_customer_from_request instead.' ); /** * Fires when the Checkout Block/Store API updates a customer from the API request data. * * @since 7.2.0 * * @param \WC_Customer $customer Customer object. * @param \WP_REST_Request $request Full details about the request. */ do_action( 'woocommerce_store_api_cart_update_customer_from_request', $customer, $request ); $customer->save(); $this->cart_controller->calculate_totals(); return rest_ensure_response( $this->schema->get_item_response( $cart ) ); } /** * Get full customer billing address. * * @param \WC_Customer $customer Customer object. * @return array */ protected function get_customer_billing_address( \WC_Customer $customer ) { $additional_fields = $this->additional_fields_controller->get_all_fields_from_object( $customer, 'billing' ); return array_merge( [ 'first_name' => $customer->get_billing_first_name(), 'last_name' => $customer->get_billing_last_name(), 'company' => $customer->get_billing_company(), 'address_1' => $customer->get_billing_address_1(), 'address_2' => $customer->get_billing_address_2(), 'city' => $customer->get_billing_city(), 'state' => $customer->get_billing_state(), 'postcode' => $customer->get_billing_postcode(), 'country' => $customer->get_billing_country(), 'phone' => $customer->get_billing_phone(), 'email' => $customer->get_billing_email(), ], $additional_fields ); } /** * Get full customer shipping address. * * @param \WC_Customer $customer Customer object. * @return array */ protected function get_customer_shipping_address( \WC_Customer $customer ) { $additional_fields = $this->additional_fields_controller->get_all_fields_from_object( $customer, 'shipping' ); return array_merge( [ 'first_name' => $customer->get_shipping_first_name(), 'last_name' => $customer->get_shipping_last_name(), 'company' => $customer->get_shipping_company(), 'address_1' => $customer->get_shipping_address_1(), 'address_2' => $customer->get_shipping_address_2(), 'city' => $customer->get_shipping_city(), 'state' => $customer->get_shipping_state(), 'postcode' => $customer->get_shipping_postcode(), 'country' => $customer->get_shipping_country(), 'phone' => $customer->get_shipping_phone(), ], $additional_fields ); } }
Warning: Class "Automattic\WooCommerce\StoreApi\Routes\V1\CartUpdateCustomer" not found in /htdocs/yes/wp-content/plugins/woocommerce/src/StoreApi/deprecated.php on line 73

Fatal error: Uncaught Error: Class "Automattic\WooCommerce\StoreApi\Formatters\CurrencyFormatter" not found in /htdocs/yes/wp-content/plugins/woocommerce/src/StoreApi/Formatters.php:45 Stack trace: #0 /htdocs/yes/wp-content/plugins/woocommerce/src/StoreApi/StoreApi.php(127): Automattic\WooCommerce\StoreApi\Formatters->register('currency', 'Automattic\\WooC...') #1 /htdocs/yes/wp-content/plugins/woocommerce/src/Blocks/Registry/AbstractDependencyType.php(42): Automattic\WooCommerce\StoreApi\StoreApi::Automattic\WooCommerce\StoreApi\{closure}(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #2 /htdocs/yes/wp-content/plugins/woocommerce/src/Blocks/Registry/SharedType.php(28): Automattic\WooCommerce\Blocks\Registry\AbstractDependencyType->resolve_value(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #3 /htdocs/yes/wp-content/plugins/woocommerce/src/Blocks/Registry/Container.php(96): Automattic\WooCommerce\Blocks\Registry\SharedType->get(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #4 /htdocs/yes/wp-content/plugins/woocommerce/src/StoreApi/StoreApi.php(117): Automattic\WooCommerce\Blocks\Registry\Container->get('Automattic\\WooC...') #5 /htdocs/yes/wp-content/plugins/woocommerce/src/Blocks/Registry/AbstractDependencyType.php(42): Automattic\WooCommerce\StoreApi\StoreApi::Automattic\WooCommerce\StoreApi\{closure}(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #6 /htdocs/yes/wp-content/plugins/woocommerce/src/Blocks/Registry/SharedType.php(28): Automattic\WooCommerce\Blocks\Registry\AbstractDependencyType->resolve_value(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #7 /htdocs/yes/wp-content/plugins/woocommerce/src/Blocks/Registry/Container.php(96): Automattic\WooCommerce\Blocks\Registry\SharedType->get(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #8 /htdocs/yes/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/OrderAttributionServiceProvider.php(48): Automattic\WooCommerce\Blocks\Registry\Container->get('Automattic\\WooC...') #9 /htdocs/yes/wp-content/plugins/woocommerce/lib/packages/League/Container/ServiceProvider/ServiceProviderAggregate.php(102): Automattic\WooCommerce\Internal\DependencyManagement\ServiceProviders\OrderAttributionServiceProvider->register() #10 /htdocs/yes/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ExtendedContainer.php(172): Automattic\WooCommerce\Vendor\League\Container\ServiceProvider\ServiceProviderAggregate->register('Automattic\\WooC...') #11 /htdocs/yes/wp-content/plugins/woocommerce/src/Container.php(124): Automattic\WooCommerce\Internal\DependencyManagement\ExtendedContainer->get('Automattic\\WooC...') #12 /htdocs/yes/wp-content/plugins/woocommerce/includes/class-woocommerce.php(342): Automattic\WooCommerce\Container->get('Automattic\\WooC...') #13 /htdocs/yes/wp-content/plugins/woocommerce/includes/class-woocommerce.php(241): WooCommerce->init_hooks() #14 /htdocs/yes/wp-content/plugins/woocommerce/includes/class-woocommerce.php(159): WooCommerce->__construct() #15 /htdocs/yes/wp-content/plugins/woocommerce/woocommerce.php(47): WooCommerce::instance() #16 /htdocs/yes/wp-content/plugins/woocommerce/woocommerce.php(62): WC() #17 /htdocs/yes/wp-settings.php(522): include_once('/htdocs/yes/wp-...') #18 /htdocs/yes/wp-config.php(95): require_once('/htdocs/yes/wp-...') #19 /htdocs/yes/wp-load.php(50): require_once('/htdocs/yes/wp-...') #20 /htdocs/yes/wp-blog-header.php(13): require_once('/htdocs/yes/wp-...') #21 /htdocs/index.php(18): require('/htdocs/yes/wp-...') #22 {main} thrown in /htdocs/yes/wp-content/plugins/woocommerce/src/StoreApi/Formatters.php on line 45

Fatal error: Uncaught Error: Call to undefined function Automattic\Jetpack\wp_rand() in /htdocs/yes/wp-content/plugins/woocommerce/vendor/automattic/jetpack-a8c-mc-stats/src/class-a8c-mc-stats.php:161 Stack trace: #0 /htdocs/yes/wp-content/plugins/woocommerce/vendor/automattic/jetpack-a8c-mc-stats/src/class-a8c-mc-stats.php(99): Automattic\Jetpack\A8c_Mc_Stats->build_stats_url(Array) #1 /htdocs/yes/wp-content/plugins/woocommerce/vendor/automattic/jetpack-a8c-mc-stats/src/class-a8c-mc-stats.php(124): Automattic\Jetpack\A8c_Mc_Stats->get_stats_urls() #2 /htdocs/yes/wp-content/plugins/woocommerce/includes/class-woocommerce.php(414): Automattic\Jetpack\A8c_Mc_Stats->do_server_side_stats() #3 [internal function]: WooCommerce->log_errors() #4 {main} thrown in /htdocs/yes/wp-content/plugins/woocommerce/vendor/automattic/jetpack-a8c-mc-stats/src/class-a8c-mc-stats.php on line 161