Skip to main content
  1. All Posts/

google-listings-and-ads

Tools Open Source Sync WordPress

Google Listings & Ads

A native integration with Google offering free listings and Performance Max ads to WooCommerce merchants.

Support

This repository is not suitable for support. Please don’t use our issue tracker for support requests.
For self help, start with our user documentation.
The best place to get support is the WordPress.org Google Listings and Ads forum.
If you have a WooCommerce.com account, you can start a chat or open a ticket on WooCommerce.com.

Prerequisites

We aim to support the latest two minor versions of WordPress, WooCommerce, and PHP. (L-2 policy)

  • WordPress 5.9+
  • WooCommerce 6.9+
  • PHP 7.4+

Browsers supported

As per WordPress Core Handbook we currently support:

  • Last 1 Android versions.
  • Last 1 ChromeAndroid versions.
  • Last 2 Chrome versions.
  • Last 2 Firefox versions.
  • Last 2 Safari versions.
  • Last 2 iOS versions.
  • Last 2 Edge versions.
  • Last 2 Opera versions.
  • Browsers with > 1% usage based on can I use browser usage table

⚠️ We do not support Internet Explorer.

Development

After cloning the repo, install dependencies:

  • nvm use to be sure you’re using the recommended node version in .nvmrc
  • npm install to install JavaScript dependencies.
  • composer install to gather PHP dependencies.

Now you can build the files using one of these commands:

  • npm run build : Build a production version
  • npm run dev : Build a development version
  • npm run start : Build a development version, watch files for changes
  • npm run start:hot : Build a development version in Fast Refresh mode, watch files for changes.

Working with DEWP

The Dependency Extraction Webpack Plugin makes working with frontend dependencies not so obvious, check [Working with DEWP.md](Working with DEWP.md) for more details.

Helper Scripts

There are a number of helper scripts exposed via our package.json (below list is not exhaustive, you can view the package.json file directly to see all):

  • npm run lint:js : Run eslint over the javascript files
  • npm run lint:css : Run stylelint over the javascript files
  • npm run test:js : Run the JS test suite
  • npm run test:js:watch : Run the JS test suite, watch for changes

WordPress Code Standards

After running composer install to install PHP dependencies you can use the following command to run php code standards checks:

  • ./vendor/bin/phpcs

PHPUnit

Prerequisites

Install composer, git, npm, svn, and either wget or curl.
Change to the plugin root directory and type:

$ composer install

Change to the plugin root directory and type:

$ npm install && npm run dev

Install Test Dependencies

To run the unit tests you need WordPress, WooCommerce, and the WordPress Unit Test lib (included in the core development repository).
Install them using the install-wp-tests.sh script:

$ ./bin/install-wp-tests.sh <db-name> <db-user> <db-pass> <db-host>

Example:

$ ./bin/install-wp-tests.sh wordpress_tests root root localhost

This script installs the test dependencies into your system’s temporary directory and also creates a test database.
You can also specify the path to their directories by setting the following environment variables:

  • WP_TESTS_DIR: WordPress Unit Test lib directory
  • WP_CORE_DIR: WordPress core directory
  • WC_DIR: WooCommerce directory

Running Tests

Change to the plugin root directory and type:

$ vendor/bin/phpunit

The tests will execute and you’ll be presented with a summary.

Unit Tests and PHP 8

We support running unit tests on PHP 8.
In order to have tests running, please, execute the following line just before the phpunit call:

composer require phpunit/phpunit "^9.5" --dev --update-with-all-dependencies

The above will update PHPUnit to version 9 including all of its dependencies.
NOTE! Do not commit the changes made, committing phpunit/phpunit: ^9.5 dependency changes to composer.json file will break the CI.

E2E Testing

E2E testing uses @woocommerce/e2e-environment which requires Docker.
Make sure Docker is running in your machine, and run the following:
npm run docker:up – This will automatically download and run WordPress in a Docker container. You can access it at http://localhost:8084 (Username: admin, Password: password).
Run E2E testing:

  • npm run test:e2e to run the test in headless mode.
  • npm run test:e2e-dev to run the tests in Chromium browser.

To remove the Docker container and images (this will delete everything in the WordPress Docker container):
npm run docker:down
⚠️ Currently, the E2E testing on GitHub Actions is only run automatically after opening a PR with release/* branches or pushing changes to release/* branches. To run it manually, please visit here and follow this instruction to do so.

Linux Troubleshooting

If you encounter problems starting your test:e2e, like No usable sandbox! or UnhandledPromiseRejectionWarning: Error: Page crashed!, you may try disabling the Chromium sandbox by adding --no-sandbox to launch.args in /tests/e2e/config/jest-puppeteer.config.js#L7.

Docs

  • Usage Tracking
  • Hooks defined or used in GLA

Made with 💜 by WooCommerce.
We’re hiring! Come work with us!