-
Notifications
You must be signed in to change notification settings - Fork 21
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
base: add/support-core-gtin-field
Are you sure you want to change the base?
Hide GTIN
field for new installs make readonly for existing installs
#2622
Conversation
…ed and what version of WC is installed
public function set_readonly( $value = false ) { | ||
$this->is_readonly = $value; | ||
|
||
return $this; | ||
} | ||
/** | ||
* @param bool $value | ||
* | ||
* @return InputInterface | ||
*/ | ||
public function set_disabled( $value = false ) { | ||
$this->is_disabled = $value; | ||
|
||
return $this; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT of adding the types in the arguments and signature fore these 2?
public function set_readonly(bool $value = false ): InputInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another concern I have is that disabled
is the right name to use for a hidden field. As in HTML disabled inputs are still readable. So I would suggest is_hidden
/ set_hidden
but not a blocker tho, just following the naming for PR name and issue description:
... GTIN field in Google for WooCommerce will need to be hidden for new users of the extension and made read-only for existing users...
* | ||
* @var string | ||
*/ | ||
private $hidden_from = '2.8.5'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COuld we add the keyword version
somewhere in this field, also should this be a constant instead?
protected function gla_installed_after( $date ): bool { | ||
$gla_installed = $this->options->get( OptionsInterface::INSTALL_TIMESTAMP, false ); | ||
|
||
if ( false === $gla_installed ) { | ||
return false; | ||
} | ||
|
||
return ( $gla_installed >= strtotime( $date ) ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are we using this?
@@ -60,6 +73,9 @@ class Input extends Form implements InputInterface { | |||
public function __construct( string $type, string $block_name ) { | |||
$this->type = $type; | |||
$this->block_name = $block_name; | |||
|
|||
$this->set_options_object( woogle_get_container()->get( OptionsInterface::class ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to instantiate the container in all the inputs? Maybe we can just do this in GTIN?
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:
9.2.0
or higher is installed and Google for WooCommerce is installed for the first time theGTIN
field in G4W is hidden9.2.0
or higher is installed and Google for WooCommerce had already been installed on a website then theGTIN
field in G4W is read-only9.2.0
is installed then theGTIN
field in G4W continues to function as it previously didAdditionally, 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:
Detailed test instructions:
update/2615-hide-gtin-for-new-users-make-readonly-for-exisitng
on a site with WC9.1.0
installed that has already onboarded with Google for WooCommerceGTIN
field is available on theGoogle for WooCommerce
tab9.2.0
or higherGTIN
field is read-only and the tooltip directs merchants to theInventory
tabwp option update gla_install_version 2.8.4
GTIN
field is not displayed on theGoogle for WooCommerce
tab when editing a productChangelog entry