目录
Zhuo (Joe) Chen

Remove the retired WooCommerce connection bridge (#4014)

Summary:

Description

Removes the retired WooCommerce-hosted OAuth and token-exchange bridge together with the legacy settings controller and UI assets that supported it.

This change:

  • removes the legacy connection callback, URL builders, constants, exception, notices, and related tests;
  • removes the retired settings controller and its unused connection and advertising assets;
  • always routes Facebook settings through the current enhanced settings experience;
  • normalizes obsolete connection and advertise tab bookmarks to an available enhanced-settings screen before assets load;
  • directs the disconnected Product Sync CTA to the plugin settings page;
  • preserves embedded Commerce Partner Hub onboarding, app-store login, REST, webhook, disconnect, CPI repair, and the Product Sync rollout fallback;
  • adds focused coverage for enhanced settings routing, connected stores without CPI, obsolete tab normalization, Product Sync fallback behavior, and scheduled CPI repair.

There are no database migrations or new database writes. Installing or upgrading the plugin does not rewrite existing merchant connection data. Existing CPI repair continues through the daily installation refresh path.

Why Shops::add_notices() is removed

The method only handled wc_facebook_connection_failed, which was set exclusively by the deleted legacy callback, and its retry link depended on the deleted get_connect_url(). The active invalid-token state uses the separate wc_facebook_connection_invalid transient and remains handled globally by WC_Facebookcommerce::add_connection_invalid_notice().

Compatibility note

This removes developer-facing methods, constants, filters, and WooCommerce\Facebook\API\Exceptions\ConnectApiException associated with the retired connection and settings paths. Repository-wide searches found no remaining first-party callers, but third-party integrations using these APIs may require updates.

Type of change

  • Break (change that can affect existing public API consumers)

Checklist

  • I have commented my code where necessary.
  • I have confirmed that the changed production files introduce no PHPCS warnings or errors.
  • I followed general pull request best practices.
  • Tests were added or updated for the expanded behavior.
  • Documentation changes are not required beyond the compatibility note above.
  • CI has passed for the updated commit.
  • Final manual verification is complete for the updated commit.

Changelog entry

Remove the retired WooCommerce-hosted Facebook connection and settings bridge.

Pull Request resolved: https://github.com/facebook/facebook-for-woocommerce/pull/4014

Test Plan:

Completed locally

  • git diff --check.
  • PHP syntax checks for every surviving changed PHP file.
  • PHPCS on all modified production PHP files.
  • JavaScript unit tests: 109 tests passed.
  • Static searches confirmed there are no remaining references to the removed settings controller, exception, or connection URL helpers.

CI

  • PHP unit tests on supported PHP versions.
  • Integration tests on supported PHP versions.
  • JavaScript tests, PHP coding standards, CodeQL, secret scanning, and plugin artifact build.
  • E2E suites.

Manual verification

  1. On a disconnected store, open Marketing > Facebook and confirm the current Commerce Partner Hub splash loads.
  2. Complete onboarding and confirm the connection persists after reload.
  3. On a connected store with CPI, confirm Overview, Settings, and Attribute Mapping load normally.
  4. On a connected store without CPI, confirm the enhanced settings experience is still used and no legacy connection UI appears.
  5. Open bookmarked URLs using tab=connection and tab=advertise; confirm each normalizes to an available enhanced-settings screen with the correct assets.
  6. With the all-products-sync rollout disabled, confirm Product Sync remains available and its disconnected CTA opens Facebook settings.
  7. Exercise the daily installation refresh with a connected store missing CPI and confirm CPI is repaired before configuration is updated.
  8. Exercise a normal disconnect and reconnect through the current embedded experience.
  9. In browser Network tools, confirm there are no requests to integrations/v2/auth/facebook, integrations/v2/exchange/facebook, integrations/auth/facebookcommerce, or wc-api=wc_facebook_connect.

Screenshots

Not included; this removes retired paths without introducing a new UI.

Differential Revision: D117566170

Pulled By: jczhuoMeta

fbshipit-source-id: 6d6446bdd23c33465422e140ebc784afad01e1b4

4天前2769次提交

Meta for WooCommerce, formerly Facebook for WooCommerce, is now an official plugin from Meta.

PHP Coding Standards

We’re excited to announce that the plugin is is now owned by Meta, and we invite the developer community to join us in shaping its future through contributions.

Grow your business on Facebook, Instagram and WhatsApp. Easily promote your products and target accurately using powerful sales and marketing tools. Update your customers about their orders on WhatsApp at every step, freeing up more time for you to focus on your business. Reach new customers and drive traffic to your website with seamless ad experiences, from discovery to conversion. Automatically sync your eligible products to your Meta catalog, so you can easily create ads right where your customers are.

  • Help drive better ad performance by setting up a conversion pixel
  • Easily set up your ads with a one-time account connection
  • Sell from one inventory that automatically syncs to your catalog used for ads

This is the development repository for the Meta for WooCommerce plugin.

Support

Please first take a look at the Meta helpcenter docs, by searching for keywords like ‘WooCommerce’ here. If you didn’t find what you were looking for, you can go to Meta direct support and ask your question.

If you have a WooCommerce.com account, you can search for help or submit a help request on WooCommerce.com.

Logging

The plugin offers logging that can help debug various problems. You can enable debug mode in the main plugin settings panel under the Enable debug mode section. By default plugin omits headers in the requests to make the logs more readable. If debugging with headers is necessary you can enable the headers in the logs by setting wc_facebook_request_headers_in_debug_log option to true.

Crash recovery limitation (known gap)

Crash recovery uses a shutdown handler to write a disable flag and queue a sanitized crash report. In rare PHP memory-exhaustion fatals, the process may not have enough memory left to run the shutdown handler. When that happens, the site still recovers on the next request, but the disable flag and crash report may be skipped for that request.

Development

Developing

  • Clone this repository into the wp-content/plugins/ folder your WooCommerce development environment.
  • Install dependencies:
    • npm install
    • composer install
  • Build assets:
    • npm start to build a development version
  • Linting:
    • npm run lint:php to run PHPCS linter on all PHP files
  • Testing:
    • ./bin/install-wp-tests.sh <test-db-name> <db-user> <db-password> [db-host] to set up testing environment
    • npm run test:php to run PHP unit tests on all PHP files
    • ./vendor/bin/phpunit --coverage-html=reports/coverage to run PHP unit tests with coverage

Running E2E tests locally (events flow)

Use the helper script at tests/e2e/scripts/run-local-events.sh.

Before running it, export all required environment variables (the script reads values directly from your process environment):

export WORDPRESS_PATH="/absolute/path/to/wordpress"
export WORDPRESS_URL="http://your-local-site.test"

export WP_USERNAME="admin"
export WP_PASSWORD="admin"
export WP_CUSTOMER_USERNAME="customer"
export WP_CUSTOMER_PASSWORD="customer"

export TEST_PRODUCT_URL="${WORDPRESS_URL%/}/product/beanie/"
export TEST_CATEGORY_URL="${WORDPRESS_URL%/}/product-category/clothing/accessories/"
export TEST_FBCLID="IwAR123TestClickId456"

export FB_E2E_TEST_COOKIE_NAME="facebook_test_id"
export FB_E2E_LOGGER_PATH="/tests/e2e/helpers/php/event-logger.php"

export WP_DEBUG_LOG="${WORDPRESS_PATH}/wp-content/debug.log"
export WC_LOG_PATH="${WORDPRESS_PATH}/wp-content/uploads/wc-logs"

Then run:

./tests/e2e/scripts/run-local-events.sh

Optional flags:

./tests/e2e/scripts/run-local-events.sh --project chromium-wp-customer --workers 1
./tests/e2e/scripts/run-local-events.sh --spec tests/e2e/theme-compatibility.spec.js

# Run with real browser binaries
./tests/e2e/scripts/run-local-events.sh --project edge-wp-customer --real-edge
./tests/e2e/scripts/run-local-events.sh --project firefox-wp-customer --real-firefox
./tests/e2e/scripts/run-local-events.sh --project brave-wp-customer --real-brave
./tests/e2e/scripts/run-local-events.sh --project opera-wp-customer --real-opera

# Allow script-driven install when browser is missing
./tests/e2e/scripts/run-local-events.sh --project edge-wp-customer --real-edge --auto-install
./tests/e2e/scripts/run-local-events.sh --project firefox-wp-customer --real-firefox --auto-install
./tests/e2e/scripts/run-local-events.sh --project brave-wp-customer --real-brave --auto-install
./tests/e2e/scripts/run-local-events.sh --project opera-wp-customer --real-opera --auto-install

⚠️ --auto-install may run sudo, install system packages, and add apt repositories/keyrings on Linux. It is opt-in and should only be used in trusted local dev environments.

Production build

  • npm run build : Builds a production version.

Releasing

Refer to the wiki for details of how to build and release the plugin.

PHPCS Linting and PHP 8.1+

We currently do not support PHPCS on PHP 8.1+ versions. Please run PHPCS checks on PHP 8.0 or lower versions. Refer #2624 PR for additional context.

License

Meta for WooCommerce is licensed under the GNU General Public License v2.0 (or later).

See the LICENSE file for the full license text.

邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号