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

Allow nullable variant id in Product Complex Rule Conditions #210

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

qadeersahmed
Copy link

@qadeersahmed qadeersahmed commented May 7, 2023

Allow null values for variant id in complex rule condition.
The variant_id in complex rules conditions is not array but the integer as per documentation.

image

Allow null values for variant id in complex rule condition.
@qadeersahmed qadeersahmed requested a review from jswift as a code owner May 7, 2023 04:19
Complex Rule Condition Null Variant ID
@qadeersahmed qadeersahmed changed the title Complex Rule Condition Null Variant ID Allow nullable variant id in Product Complex Rule Conditions May 7, 2023
Incorporate Null Adjuster from API for FIXED adjuster value.
Fix for Null adjuster value from API for FIXED type.
Incorporate Null Adjuster from API for FIXED adjuster value.
Fix for Null adjuster value from API for FIXED type.
Allow usage of optionObject when overriding functions.
Allow usage of optionObject when overriding functions.
Using class constants.
Using Class Constants
{
if (!is_null($this->optionObject)) {
if(is_null($this->optionObject->adjuster)){
$this->optionObject->adjuster = self::ADJUSTER_FIXED;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this to handle the case of BigCommerce not returning the adjuster property?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, this will handle when BigCommerce is not returning adjuster property.

Copy link
Author

Choose a reason for hiding this comment

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

It is usally not returning adjuster property when in store front we have fixed type of adjuster.

@jswift
Copy link
Collaborator

jswift commented May 11, 2023

Thank you for this! It seems there are two different changes included here, the bug fix for variantid, and a change to add a default value for the adjusters.

I've created a pull request for a simpler way to set the default value here: https://github.com/aligent/bigcommerce-v3-api-php-client/pull/211/files, does that meet your requirements?

Would you be able to do the pull request to be only the bug fix?

@qadeersahmed
Copy link
Author

Variant ID is also sometimes not assigned in the store for conditions in complex rules. This is not allowing to incorporate those cases.
Furthermore when adjuster is "fixed" in store frontend API is not returning "fixed" instead it returns null so we have to set default value as well.

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