searchspring / snap

Snap is Searchspring's latest front end integration SDK
https://searchspring.github.io/snap/
MIT License
8 stars 0 forks source link

Variant Enhancement Docs #1063

Closed korgon closed 2 weeks ago

korgon commented 1 month ago

Several new features have been released relating to variant support with and without bundle recommendations.

Many of these features are un-documented and need to be added to the Snap docs. The list below covers much of what needs to be added, but may not be all inclusive. Please add anything else that may be missing.

Controller Configuration: Search, Autocomplete and Recommendation controllers support variants, and should be documented with the new variant configuration options (VariantConfig).

https://searchspring.github.io/snap/#/package-controller-search https://searchspring.github.io/snap/#/package-controller-autocomplete https://searchspring.github.io/snap/#/package-controller-recommendation

VariantConfig = {
    field: string;
    realtime?: {
        enabled: boolean;
        filters?: VariantConfigFilterTypes[];
    };
    options?: {
        [optionField: string]: VariantOptionConfig;
    };
};

Explanation of the filters and the filter types should be included.

Variant Option Attributes: When 'realtime' is enabled the attributes 'ss-variant-option' and 'ss-variant-option-selected' are queried for and used to determine current variant selection and to also attach click events to know when to adjust variant selections in the selection stores. This is a feature that needs to be documented in detail so that implementations can leverage it and know exactly how to tie into it and configure it.

Platform Add to Cart: Several of the addToCart functions simply will not work unless variants have been configured (via controller configuration) - this needs to be called out in the documentation where it applies.