Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide GTIN field for new installs make readonly for existing installs #2622

Open
wants to merge 20 commits into
base: add/support-core-gtin-field
Choose a base branch
from

Conversation

martynmjones
Copy link
Contributor

@martynmjones martynmjones commented Sep 20, 2024

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 martynmjones self-assigned this Sep 20, 2024
@github-actions github-actions bot added the changelog: update Big changes to something that wasn't broken. label Sep 20, 2024
@martynmjones martynmjones changed the base branch from develop to add/support-core-gtin-field September 23, 2024 18:02
@martynmjones martynmjones requested a review from a team September 24, 2024 21:40
@martynmjones martynmjones marked this pull request as ready for review September 24, 2024 21:40
src/Admin/Input/Input.php Outdated Show resolved Hide resolved
src/Admin/Input/Input.php Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 6, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Project coverage is 65.4%. Comparing base (2c8f6d2) to head (d677d3d).
Report is 5 commits behind head on add/support-core-gtin-field.

Files with missing lines Patch % Lines
src/Admin/Product/Attributes/Input/GTINInput.php 88.9% 1 Missing ⚠️
src/Internal/InstallTimestamp.php 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                       @@
##             add/support-core-gtin-field   #2622     +/-   ##
===============================================================
+ Coverage                           64.7%   65.4%   +0.6%     
- Complexity                          4596    4608     +12     
===============================================================
  Files                                793     474    -319     
  Lines                              22970   17927   -5043     
  Branches                            1231       0   -1231     
===============================================================
- Hits                               14868   11716   -3152     
+ Misses                              7929    6211   -1718     
+ Partials                             173       0    -173     
Flag Coverage Δ
js-unit-tests ?
php-unit-tests 65.4% <92.3%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Admin/Input/Input.php 100.0% <100.0%> (ø)
src/Admin/Product/Attributes/AttributesForm.php 97.3% <100.0%> (+<0.1%) ⬆️
src/Admin/Product/Attributes/Input/GTINInput.php 92.9% <88.9%> (-7.1%) ⬇️
src/Internal/InstallTimestamp.php 0.0% <0.0%> (ø)

... and 319 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: update Big changes to something that wasn't broken.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GTIN] Hide the Global Trade Item Number field for new users and make read-only for existing users
2 participants