Skip to content

Conversation

@sldblog
Copy link
Contributor

@sldblog sldblog commented Mar 17, 2023

Extends the type: variant schema to allow a new attribute, only_from, which will limit the product types available in the first variant dropdown.

Start First dropdown: products Second dropdown: variant and extras
image image ℹ️ Depends on choice in the first dropdown.

image

We want to allow creators to choose the relevant types of products for blocks using this type.

Example:

variants:
  group: content
  label: Select variants to feature
  type: variant
  array: true
  default:
    - random
    - random
    - random
  only_from:
    - experiences

Related to #43.

sldblog added 3 commits March 17, 2023 12:12
The new attribute is

1. optional
2. has to be a non-empty array

The intent is to provide a way for creators and theme developers to
limit the available product options under the variant type to either
experiences or accommodation, as appropriate.

It is intentionally reusing Product::ALLOWED_RESTRICTIONS because it's
limiting the product options.
(This is a new, non-breaking feature)
@sldblog
Copy link
Contributor Author

sldblog commented Mar 17, 2023

@sldblog sldblog changed the title Support limiting options for variant type Support limiting product options for variant type Mar 17, 2023
@sldblog sldblog requested review from a team, CatalinaTudor and eballantine and removed request for a team March 17, 2023 12:24
@ianmooney ianmooney self-assigned this Mar 17, 2023
Copy link
Contributor

@ianmooney ianmooney left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@eballantine eballantine left a comment

Choose a reason for hiding this comment

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

Nice one David!

@sldblog sldblog merged commit 189f31d into main Mar 20, 2023
@sldblog sldblog deleted the support-limiting-options-for-variant-type branch March 20, 2023 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants