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

Add term meta setting to store term-level RRM settings #9956

Open
2 tasks
nfmohit opened this issue Jan 2, 2025 · 0 comments
Open
2 tasks

Add term meta setting to store term-level RRM settings #9956

nfmohit opened this issue Jan 2, 2025 · 0 comments
Assignees
Labels
P0 High priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@nfmohit
Copy link
Collaborator

nfmohit commented Jan 2, 2025

Feature Description

As part of RRM Phase 2, the WordPress taxonomy term screens will allow users to override the snippet configuration at the taxonomy term level. To facilitate this, a term meta setting should be added to store the term-level configuration.

A Modules\Reader_Revenue_Manager\Term_Product_ID class extending the Core\Storage\Term_Meta_Setting class should be created to register a term meta setting to store the taxonomy term-level snippet options. It should hold an empty string as the value by default. The meta key can be googlesitekit_rrm_{Publication ID}:productID.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • When the rrmModuleV2 feature flag is enabled:
    • A new term meta setting should be registered using the new term meta infrastructure that will store the per-term-level snippet configuration for Reader Revenue Manager.
    • The meta key should include the publication ID so that it can be uniquely identified when the connected publication changes.
    • The meta value by default should be an empty string, and it should only accept a string as the value.

Implementation Brief

  • Create a class Term_Product_ID inside includes/Modules/Reader_Revenue_Manager.

    • It should accept the instance of Core\Storage\Term_Meta and the publication ID in it's constructor. The publication ID can be assigned to a private class property which would then be utilised to form the meta key.
    • It extends Google\Site_Kit\Core\Storage\Term_Meta_Setting class (added in Add term meta infrastructure #9949).
    • Override the get_meta_key which should return googlesitekit_rrm_{publication_id}:productID. Taking publication_id from the value passed to the contructor.
  • In includes/Modules/Reader_Revenue_Manager.php

    • In register method, check if rrmModuleV2 feature is enabled using Feature_Flags::enabled( 'rrmModuleV2' ). If feature is enabled and module is connected, do the following.
      • Instantiate Core\Storage\Term_Meta class.
      • Instantiate Term_Product_ID and pass instance of Core\Storage\Post_Meta and the publication ID to it's constructor.
      • Call register method of the Term_Product_ID class.

TODO: Complete based on the implementation of the Term_Meta class in #9949 and its methods.

Test Coverage

  • Write tests for Test_Product_ID class.
  • Fix any failing tests.

QA Brief

Changelog entry

@nfmohit nfmohit added P0 High priority Type: Enhancement Improvement of an existing feature Team M Issues for Squad 2 labels Jan 2, 2025
@benbowler benbowler self-assigned this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants