Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add support for Order Source Attribution #11506

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Wrap OrderSourceAttribution init in a try/catch block
This depends on woocommerce/woocommerce#39701 being merged. This can be tested locally, but running automated testing will fail due to the files in WooCommerce core being missing.
  • Loading branch information
JPry authored and budzanowski committed Nov 15, 2023
commit a88039669691c2a5d83937f05abe1d1dabb65f1d
14 changes: 13 additions & 1 deletion src/Domain/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use Automattic\WooCommerce\Blocks\Templates\SingleProductTemplateCompatibility;
use Automattic\WooCommerce\Blocks\Templates\ArchiveProductTemplatesCompatibility;
use Automattic\WooCommerce\Blocks\Domain\Services\OnboardingTasks\TasksController;
use Automattic\WooCommerce\Vendor\League\Container\Exception\NotFoundException;

/**
* Takes care of bootstrapping the plugin.
Expand Down Expand Up @@ -137,7 +138,18 @@ function() {
$this->container->get( ShippingController::class )->init();
$this->container->get( TasksController::class )->init();
$this->container->get( JetpackWooCommerceAnalytics::class )->init();
$this->container->get( OrderSourceAttribution::class )->init();

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is temporary but wouldn't it be better to gate this based on class existence either here or within the init method?

$this->container->get( OrderSourceAttribution::class )->init();
} catch ( NotFoundException $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch

/*
* This will fail until #39701 is merged into WooCommerce core.
*
* @see https://github.com/woocommerce/woocommerce/pull/39701
* @todo Remove this try/catch once the PR is merged.
*/
}

// Load assets in admin and on the frontend.
if ( ! $is_rest ) {
Expand Down