woocommerce / google-listings-and-ads

Sync your store with Google to list products for free, run paid ads, and track performance straight from your store dashboard.
https://woo.com/products/google-listings-and-ads/
GNU General Public License v3.0
47 stars 21 forks source link
javascript php react woocommerce wordpress

Google for WooCommerce

PHP Unit Tests JavaScript Unit Tests PHP Coding Standards JavaScript and CSS Linting Build

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 for WooCommerce 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)

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

:warning: We do not support Internet Explorer.

Development

After cloning the repo, install dependencies:

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

Notice this repository has engine-strict=true directive set. That means you cannot install dependencies with other Node engines rather than the ones defined in the engines directive inside package.json. It's recommended to use NVM and run nvm use before installing the dependencies to be sure you're using the recommended Node version.

The engines in package.json includes npm ^9 to allow dependabot to update our dependencies. However, it's not the version intended to be used in development.

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):

WordPress Code Standards

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

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:

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.

E2E Testing

E2E testing uses wp-env which requires Docker.

Make sure Docker is running in your machine, and run the following:

npm run wp-env:up - This will automatically download and run WordPress in a Docker container. You can access it at http://localhost:8889 (Username: admin, Password: password).

To install the PlayWright browser locally you can run: npx playwright install chromium

Run E2E testing:

To remove the Docker container and images (this will delete everything in the WordPress Docker container):

npm run wp-env destroy

:warning: 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.

Test other WordPress versions

By default the latest version of WordPress will be installed. WP_ENV_CORE can be used to install a specific version.

WP_ENV_CORE=WordPress/WordPress#6.2.2 npm run wp-env:up

This does not work with Release Candidate versions as the tag is not available. Instead we can bring the wp-env:up with the latest version and then upgrade WordPress through WP CLI.

npm run -- wp-env run tests-cli -- wp core update --version=6.3-RC3
npm run -- wp-env run tests-cli -- wp core update-db

Test other WooCommerce versions

WooCommerce is installed through WP CLI so we can use this to update to a newer version like a release candidate.

npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=8.0.0-rc.1
npm run -- wp-env run tests-cli -- wp wc update

Google Ads API Client Library

The new Google Ads API Client Library version is now available with PHP 7.4 support under this "legacy" branch.

We are using it in composer in order to support PHP 7.4.

Going forward, Google will always add the prefix "legacy-" for the branch supporting PHP 7.4.

Docs



Made with 💜 by Woo.
We're hiring! Come work with us!