ID this location belongs to. * * @since 10.5.0 */ public static function get_local_pickup_method_locations() { // Get the built-in pickup locations. $builtin_locations = get_option( 'pickup_location_pickup_locations', array() ); // Add method_id to built-in locations. foreach ( $builtin_locations as $index => $location ) { $builtin_locations[ $index ]['method_id'] = 'pickup_location'; } // Get all shipping methods that support local-pickup. $shipping_methods = WC()->shipping()->get_shipping_methods(); // Get store base address for placeholder locations. $base_country = WC()->countries->get_base_country(); $base_state = WC()->countries->get_base_state(); $custom_method_locations = array(); foreach ( $shipping_methods as $method ) { // Skip if method doesn't support local-pickup. if ( ! $method->supports( 'local-pickup' ) ) { continue; } // Skip the built-in pickup_location method (already handled above). if ( 'pickup_location' === $method->id ) { continue; } // Create a placeholder location for this custom method. $custom_method_locations[] = array( 'name' => $method->get_method_title(), 'enabled' => true, 'address' => array( 'address_1' => '123 Main Street', 'city' => 'Sample City', 'state' => $base_state, 'postcode' => '12345', 'country' => $base_country, ), 'details' => sprintf( /* translators: %s: shipping method title */ __( 'Pickup location for %s', 'woocommerce' ), $method->get_method_title() ), 'method_id' => $method->id, ); } return array_merge( $builtin_locations, $custom_method_locations ); } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\StoreApi\Utilities\LocalPickupUtils" not found in /htdocs/wp-content/plugins/woocommerce/src/Blocks/Shipping/ShippingController.php:56 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php(393): Automattic\WooCommerce\Blocks\Shipping\ShippingController->__construct(Object(Automattic\WooCommerce\Blocks\Assets\Api), Object(Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry)) #1 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/AbstractDependencyType.php(42): Automattic\WooCommerce\Blocks\Domain\Bootstrap->Automattic\WooCommerce\Blocks\Domain\{closure}(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #2 /htdocs/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/wp-content/plugins/woocommerce/src/Blocks/Registry/Container.php(96): Automattic\WooCommerce\Blocks\Registry\SharedType->get(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #4 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php(133): Automattic\WooCommerce\Blocks\Registry\Container->get('Automattic\\WooC...') #5 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php(73): Automattic\WooCommerce\Blocks\Domain\Bootstrap->init() #6 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Package.php(106): Automattic\WooCommerce\Blocks\Domain\Bootstrap->__construct(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #7 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/AbstractDependencyType.php(42): Automattic\WooCommerce\Blocks\Package::Automattic\WooCommerce\Blocks\{closure}(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #8 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/SharedType.php(28): Automattic\WooCommerce\Blocks\Registry\AbstractDependencyType->resolve_value(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #9 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Registry/Container.php(96): Automattic\WooCommerce\Blocks\Registry\SharedType->get(Object(Automattic\WooCommerce\Blocks\Registry\Container)) #10 /htdocs/wp-content/plugins/woocommerce/src/Blocks/Package.php(44): Automattic\WooCommerce\Blocks\Registry\Container->get('Automattic\\WooC...') #11 [internal function]: Automattic\WooCommerce\Blocks\Package::init() #12 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(292): call_user_func(Array) #13 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(90): Automattic\WooCommerce\Packages::initialize_packages() #14 /htdocs/wp-includes/class-wp-hook.php(341): Automattic\WooCommerce\Packages::on_init('') #15 /htdocs/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #16 /htdocs/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #17 /htdocs/wp-settings.php(593): do_action('plugins_loaded') #18 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #19 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #20 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #21 /htdocs/index.php(17): require('/htdocs/wp-blog...') #22 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Blocks/Shipping/ShippingController.php on line 56