google-listings-and-ads icon indicating copy to clipboard operation
google-listings-and-ads copied to clipboard

Hide `GTIN` field for new installs make readonly for existing installs

Open martynmjones opened this issue 5 months ago • 0 comments

Changes proposed in this Pull Request:

Adds restrictions to the GTIN field in Google for WooCommerce depending on the version of WooCommerce installed and what version of Google for WooCommerce was first installed.

The following conditions apply:

  1. If WooCommerce 9.2.0 or higher is installed and Google for WooCommerce is installed for the first time the GTIN field in G4W is hidden
  2. If WooCommerce 9.2.0 or higher is installed and Google for WooCommerce had already been installed on a website then the GTIN field in G4W is read-only
  3. If any version of WooCommerce lower than 9.2.0 is installed then the GTIN field in G4W continues to function as it previously did

Additionally, a new option is added called INSTALL_VERSION for tracking what version of Google for WooCommerce was first installed on a website 43a76c3.

Closes #2615

Screenshots:

Screenshot 2024-09-20 at 17 46 09

Detailed test instructions:

  1. Checkout update/2615-hide-gtin-for-new-users-make-readonly-for-exisitng on a site with WC 9.1.0 installed that has already onboarded with Google for WooCommerce
  2. Add or edit a product and confirm that the GTIN field is available on the Google for WooCommerce tab
  3. Update WooCommerce to version 9.2.0 or higher
  4. Add or edit a product and confirm that the GTIN field is read-only and the tooltip directs merchants to the Inventory tab
  5. Install the extension from this branch on a new test site and go through onboarding
    • Alternatively, run the following WP Cli command to simulate the first install wp option update gla_install_version 2.8.4
  6. Confirm that the GTIN field is not displayed on the Google for WooCommerce tab when editing a product

Changelog entry

Update - Restrict the GTIN field based on the version of WooCommerce installed and the initial version of G4W installed

martynmjones avatar Sep 20 '24 16:09 martynmjones