>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, ) ); 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 ) { $validation_util = new ValidationUtils(); $billing_country = $customer->get_billing_country(); $billing_state = $customer->get_billing_state(); /** * There's a bug in WooCommerce core in which not having a state ("") would result in us validating against the store's state. * This resets the state to an empty string if it doesn't match the country. * * @todo Removing this handling once we fix the issue with the state value always being the store one. */ if ( ! $validation_util->validate_state( $billing_state, $billing_country ) ) { $billing_state = ''; } return [ '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' => $billing_state, 'postcode' => $customer->get_billing_postcode(), 'country' => $billing_country, 'phone' => $customer->get_billing_phone(), 'email' => $customer->get_billing_email(), ]; } /** * Get full customer shipping address. * * @param \WC_Customer $customer Customer object. * @return array */ protected function get_customer_shipping_address( \WC_Customer $customer ) { return [ '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(), ]; } }
Warning: Class "Automattic\WooCommerce\StoreApi\Routes\V1\CartUpdateCustomer" not found in /htdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/deprecated.php on line 73

Fatal error: Uncaught Error: Class "MailPoetVendor\Doctrine\DBAL\Types\BigIntType" not found in /htdocs/wp-content/plugins/mailpoet/lib/Doctrine/Types/BigIntType.php:12 Stack trace: #0 /htdocs/wp-content/plugins/build-app-online/admin/vendor/composer/ClassLoader.php(571): include() #1 /htdocs/wp-content/plugins/build-app-online/admin/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/htdocs/wp-cont...') #2 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(570): Composer\Autoload\ClassLoader->loadClass('MailPoet\\Doctri...') #3 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2852): MailPoetGenerated\FreeCachedContainer->getConnectionService() #4 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(580): MailPoetGenerated\FreeCachedContainer->getEntityManagerFactoryService() #5 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(4214): MailPoetGenerated\FreeCachedContainer->getEntityManagerService() #6 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(4204): MailPoetGenerated\FreeCachedContainer->getSettingsRepositoryService() #7 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2269): MailPoetGenerated\FreeCachedContainer->getSettingsControllerService() #8 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService() #9 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1) #10 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...') #11 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...') #12 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(206): require_once('/htdocs/wp-cont...') #13 /htdocs/wp-settings.php(462): include_once('/htdocs/wp-cont...') #14 /htdocs/wp-config.php(96): require_once('/htdocs/wp-sett...') #15 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #16 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #17 /htdocs/index.php(17): require('/htdocs/wp-blog...') #18 {main} thrown in /htdocs/wp-content/plugins/mailpoet/lib/Doctrine/Types/BigIntType.php on line 12