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

feat: add more Woo conditions to Block Conditions module #2281

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

HardeepAsrani
Copy link
Member

Closes https://github.com/Codeinwp/otter-internals/issues/198.

Summary

This PR adds:

  • Product Category
  • Product Tag
  • Product Attribute

conditions to Block Conditions module.

Screenshots


Test instructions

  • You can import WooCommerce's sample data to get a good set of products.
  • Confirm all the conditions work when the taxonomy is present/absent.
  • There are no debugging errors.
  • This is made for Product Page, so you must be using a FSE theme for being able to customize the Single Product Template.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 26, 2024
@pirate-bot
Copy link
Contributor

pirate-bot commented Jul 26, 2024

Plugin build for 698f507 is ready 🛎️!

@pirate-bot
Copy link
Contributor

pirate-bot commented Jul 26, 2024

Bundle Size Diff

Package Old Size New Size Diff
Animations 263.48 KB 263.48 KB 0 B (0.00%)
Blocks 1.52 MB 1.52 MB 1.37 KB (0.09%)
CSS 92.73 KB 92.73 KB 0 B (0.00%)
Dashboard 195.5 KB 195.5 KB 0 B (0.00%)
Onboarding 153.14 KB 153.14 KB 0 B (0.00%)
Export Import 90.21 KB 90.21 KB 0 B (0.00%)
Pro 361.57 KB 364.44 KB 2.87 KB (0.79%)

@pirate-bot
Copy link
Contributor

pirate-bot commented Jul 26, 2024

E2E Tests

Playwright Test Status:

Performance Results serverResponse: 238, firstPaint: 165.75, domContentLoaded: 1568.3, loaded: 1569, firstContentfulPaint: 3476.4, firstBlock: 6714, type: 13.14, minType: 10.79, maxType: 18.52, typeContainer: 8.53, minTypeContainer: 8.19, maxTypeContainer: 9.34, focus: 34.41, minFocus: 27.74, maxFocus: 43.95, inserterOpen: 23.99, minInserterOpen: 21.34, maxInserterOpen: 37, inserterSearch: 0.75, minInserterSearch: 0.62, maxInserterSearch: 0.93, inserterHover: 3.41, minInserterHover: 2.82, maxInserterHover: 4.63, listViewOpen: 149.76, minListViewOpen: 131.75, maxListViewOpen: 170.55

Copy link
Collaborator

@carlalexander carlalexander left a comment

Choose a reason for hiding this comment

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

Quick final note on the review as well related to commit history. I'll be doing a review of the commit history once the code changes are done. That said, I'll note for now that the chore commits should be merged into the feature commit. You don't have to fix that now if you want. I can do a review of the commit history at the end so you can just do all that then.

.gitignore Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
plugins/otter-pro/inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
plugins/otter-pro/inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
plugins/otter-pro/inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
plugins/otter-pro/inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
tests/test-woo-conditions.php Show resolved Hide resolved
Copy link
Collaborator

@carlalexander carlalexander left a comment

Choose a reason for hiding this comment

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

This is great @HardeepAsrani! Your refactor of the condition code was excellent! We're almost there.

Just to help show a bit what I'm thinking with the commit history, I would have made the refactor commit just the changes to the conditions. The rest I would have left as another commit that we're going to merge back into the feat commit.

composer.json Show resolved Hide resolved
tests/bootstrap.php Show resolved Hide resolved
tests/test-woo-conditions.php Show resolved Hide resolved
plugins/otter-pro/inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
plugins/otter-pro/inc/plugins/class-block-conditions.php Outdated Show resolved Hide resolved
@HardeepAsrani
Copy link
Member Author

Thanks @carlalexander for the review. I wanted to ask about how you feel is the best way to manage commits here. Personally, I try not to alter commits to protect their integrity even if, at times, it makes history look a bit ugly.

But what would you suggest here? We squash all of them together or some other way?

@carlalexander
Copy link
Collaborator

@HardeepAsrani left you a message in slack. Let's try to find a time to connect and I can go over that with you. 🙂

This PR adds:

- Product Category
- Product Tag
- Product Attribute

conditions to Block Conditions module

Closes: https://github.com/Codeinwp/otter-internals/issues/198
This PR implements the things pointed out in the PR review, including
better readability for block conditions, moving wp-content to vendor
folder and more.
Copy link
Collaborator

@carlalexander carlalexander left a comment

Choose a reason for hiding this comment

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

@HardeepAsrani I ended up doing the rebasing because there were merge conflicts to resolve. If you'd have preferred to do it, let me know.

I also left a video in Slack about the refactor commit and what I would have liked to see in it. But otherwise, amazing work. Thank you! 🥳

@HardeepAsrani HardeepAsrani merged commit da54f80 into development Aug 1, 2024
11 checks passed
@HardeepAsrani HardeepAsrani deleted the fix/issue-198 branch August 1, 2024 21:48
@pirate-bot
Copy link
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-checklist-complete The Pull Request checklist is complete. (automatic label) released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants