-
Notifications
You must be signed in to change notification settings - Fork 63
Add CLI command for return reasons #791
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
base: rt/return-reasons-sync-localizations
Are you sure you want to change the base?
Add CLI command for return reasons #791
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
45ca2c2 to
bffba00
Compare
bffba00 to
aead00a
Compare
7ac44ab to
6407bfb
Compare
6407bfb to
2a5b30e
Compare
7ef040a to
141afab
Compare
141afab to
ee04fbd
Compare
9cab054 to
0cba42e
Compare
ee04fbd to
ebcd6bd
Compare
ebcd6bd to
894327a
Compare
ebcd6bd to
325e803
Compare
0cba42e to
496e3a1
Compare
dev/lib/product_taxonomy/commands/add_return_reasons_to_categories_command.rb
Outdated
Show resolved
Hide resolved
dev/lib/product_taxonomy/commands/add_return_reasons_to_categories_command.rb
Outdated
Show resolved
Hide resolved
325e803 to
085d693
Compare
085d693 to
b28b2c7
Compare
b28b2c7 to
b6ff8fa
Compare
09991bd to
95e05cc
Compare
b6ff8fa to
d158482
Compare
95e05cc to
09991bd
Compare
09991bd to
95e05cc
Compare
d158482 to
babf7f6
Compare
95e05cc to
09991bd
Compare
544da27 to
a5f2a9b
Compare
09991bd to
4f42381
Compare
4f42381 to
e71dcc6
Compare
a5f2a9b to
86e945d
Compare
e71dcc6 to
4f42381
Compare
86e945d to
65bcbb2
Compare
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 want to separate the create return reasons and dump commands?
Current workflow is that running the create and attach commands will create the return reasons object and will modify the yaml directly. Do we want to separate it so that one command will create it, one command will dump it?
If this follows the existing workflow with categories where creating a category will automatically add it to the yaml then we can discard this feedback.
|
|
||
| def execute | ||
| add_return_reasons_to_categories! | ||
| update_data_files! |
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.
Since this attaches the objects and also writes to the yaml, do we want some sort of rollback or atomic transaction where if it fails to write the yaml then it also detaches it from the object?
Attaches the two objects -> writes to yaml
Attaches the two objects -> error writing to yaml -> rollback attaching the objects and signal that command failed
It could also be the case that these operations are something we can confidently say will work and not need to implement this rollback logic.
65bcbb2 to
a298db4
Compare
08cc077 to
8bf62c6
Compare
a298db4 to
7160261
Compare
7160261 to
67b8038
Compare
8bf62c6 to
3c0e3ac
Compare
- Add add_return_reason_command.rb for creating new return reasons - Auto-generates identifiers (friendly_id, handle) from name - Validates uniqueness of IDs, names, handles, friendly_ids - Triggers automatic updates: localizations, dist files, docs - Register add_return_reason command in cli.rb
- Add dump_return_reasons_command.rb - Exports in-memory return reasons to YAML format - Uses data_serializer for consistent output - Enables bulk editing workflows - Register command in cli.rb
- Add add_return_reasons_to_categories_command.rb - Maps specified return reasons to specified categories - Validates return reason references - Auto-sorts alphabetically with Unknown/Other last - Supports --include-descendants flag for cascade - Register command in cli.rb
3c0e3ac to
f0ee5dd
Compare
67b8038 to
324fcdc
Compare

Add Return Reason Management to Product Taxonomy
This PR introduces support for managing return reasons in the product taxonomy, including commands to add return reasons and associate them with product categories.
New Commands
Add Return Reason
bundle exec ./bin/product_taxonomy add_return_reason NAME DESCRIPTIONCreates a new return reason with the specified name and description, generating appropriate identifiers.
id: Next available numeric IDfriendly_id: Parameterized from name (e.g., "size-too-small")handle: Kebab-case version (e.g., "size-too-small")data/return_reasons.ymlAdd Return Reasons to Categories
bundle exec ./bin/product_taxonomy add_return_reasons_to_categories RETURN_REASON_FRIENDLY_IDS CATEGORY_IDSAssociates one or more return reasons with one or more product categories. Supports optional inclusion of descendant categories.
Dump Return Reasons
bundle exec ./bin/product_taxonomy dump_return_reasonsExports all return reasons to a YAML file for persistence.
data/return_reasons.ymlwith the current stateFeatures
Implementation Details
The PR provides a complete solution for managing product return reasons through the CLI, enabling teams to maintain this taxonomy data programmatically.