Skip to content

Add automatic Cart Attributes #84

Discussion options

You must be logged in to vote

I see, so it is something about html layout, not the liquid-ajax-cart.
I'll still check why it is happening and let you know.
Just as temporary solution you can trigger the change manually as you wanted to:

function triggerPropChange() {
    const input = document.querySelector('[name="attributes[Lieferzeit]"][data-ajax-cart-property-input]');
    if (!input) return;
    input.dispatchEvent(new Event("change", { bubbles: true }));
}

if (window.liquidAjaxCart?.init) {
    // if Liquid Ajax Cart is already initialized
    triggerPropChange();
} else {
    // wait for Liquid Ajax Cart to be initialized
    document.addEventListener("liquid-ajax-cart:init", triggerPropChange);
}

Just make s…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@elektro-hub
Comment options

@EvgeniyMukhamedjanov
Comment options

@elektro-hub
Comment options

@EvgeniyMukhamedjanov
Comment options

Answer selected by elektro-hub
@elektro-hub
Comment options

@EvgeniyMukhamedjanov
Comment options

@elektro-hub
Comment options

@EvgeniyMukhamedjanov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants