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

Product SKU Generator: Release #28

Closed

Conversation

tamarazuk
Copy link
Contributor

@tamarazuk tamarazuk commented Nov 21, 2020

Summary

This PR addresses a conflict that occurs with Square for WooCommerce and swaps the WooCommerce version check to use the WC_VERSION constant

Stories

QA

  • confirm that SKUs display as expected, now in a disabled input
    image

  • confirm that SKUs generate as expected

  • confirm that the plugin doesn't load and a notice appears if WC_VERSION constant returns a value less than 3.0.9 (you can do so editing this line)

…t occurs with Square for WooCommerce

When the [Square for WooCommerce](https://woocommerce.com/products/square/) plugin is activated, the following JavaScrip error occurs on the the product edit page because the SKU field is removed:

wc-square-admin-products.min.js:188 Uncaught TypeError: Cannot read property 'trim' of undefined

This commit replaces the inline SKU with a disabled SKU input to address conflicts like these.
@wvega wvega requested review from a team and wvega and removed request for a team November 23, 2020 14:44
Copy link
Contributor

@wvega wvega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tamarazuk thank you for putting this fix together! QA passes for me and changes look good.

All I have a is a suggestion to split is_minmum_wc_version_met() to keep the method small and with a single responsibility.

Comment on lines +247 to +250
if ( is_admin() && ! is_ajax() && ! has_action( 'admin_notices', [ $this, 'render_outdated_wc_version_notice' ] ) ) {

add_action( 'admin_notices', [ $this, 'render_outdated_wc_version_notice' ] );
}
Copy link
Contributor

@wvega wvega Nov 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract the nested if statement into another method (perhaps maybe_add_admin_notices_hooks())?

I think right now the method has two responsibilities: determining whether the version is met and registering the hook handler that will render the admin notice. To keep the methods simpler, we could extract those lines into a separate method and call it before halting functionality.

@tamarazuk tamarazuk closed this Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants