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 metafields as fact on get eligibleitems function #6758

Merged

Conversation

vanpho93
Copy link
Member

@vanpho93 vanpho93 commented Jan 13, 2023

Signed-off-by: vanpho93 vanpho02@gmail.com
Resolves #6640
Impact: major
Type: feature

Usage

Example metafields on the cart item:

...
"metafields" : [
    {
        "key" : "name",
        "value" : "Test name",
        "description": "Test"
    }
]
...

Define the inclusion/exclusion rules:

...
"inclusionRules" : {
    "conditions" : {
        "all" : [
            {
                "fact" : "keyValueArray",
                "operator" : "equal",
                "params": {
                    "fieldName": "metafields" => the metafields field in the cart item
                    "inputField": "key",
                    "inputValue": "value",
                    "outputField": "value"
                 },
                "value" : "Test name"
            }
        ]
    }
}
....

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2023

⚠️ No Changeset found

Latest commit: eeb16fa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Signed-off-by: vanpho93 <vanpho02@gmail.com>
@vanpho93 vanpho93 force-pushed the feat/filterable-excludable-attributes-on-cart branch from 9f66340 to 6b8bd48 Compare January 16, 2023 07:35
@vanpho93 vanpho93 marked this pull request as ready for review January 16, 2023 07:36
Signed-off-by: vanpho93 <vanpho02@gmail.com>
@brent-hoover
Copy link
Collaborator

I see a few problems with this. Firstly that the fact is called "keyValueArray". Does this just assume it's the cart? What if it's the customer? Secondly what if there is a second key-value-array on the product (as there is for some customers who have extended the product)?

Thirdly, will this work for Kinetic @vannguyenn? There are extra values required to access these values.

What advantage does this approach afford over just flattening out the metafields on the cart items?

…-validation

feat: improve promotion validation
@vanpho93
Copy link
Member Author

vanpho93 commented Jan 17, 2023

@zenweasel

Firstly that the fact is called "keyValueArray". Does this just assume it's the cart?

This only for checking item inclusion / exclusion, so this fact only applies to cart items.

Secondly what if there is a second key-value-array on the product (as there is for some customers who have extended the product)?

=> They just need to change "fieldName": "metafields" to their fields.

What advantage does this approach afford over just flattening out the metafields on the cart items?
Flattening still works but it will pollute the schema, can be conflicts between fields too.

@brent-hoover brent-hoover merged commit 23e79a5 into feat/promotions Jan 17, 2023
vanpho93 pushed a commit that referenced this pull request Apr 24, 2023
…able-attributes-on-cart

feat: add metafields as fact on get eligibleitems function
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