• themugician

    (@themugician)


    WooSL outputs variation data into a data-variation attribute and later stores it in a cookie.
    When a variation label contains a double quote (e.g. 5.5" x 95"), the plugin generates invalid JSON. This causes JSON.parse() to throw and breaks the Save for Later functionality.

    Steps to reproduce

    1. Create a variable product with an attribute value containing quotes, e.g.: 5.5" x 95"
    2. Add the product to the WooSL Save for Later list.
    3. Click Save / Add again.

    Actual result

    A JavaScript error occurs:

    Uncaught SyntaxError: Expected ',' or '}' after property value in JSON at JSON.parse at woosl_add_product

    The stored cookie contains invalid JSON, for example:

    "variation":"{"attribute_size-h-x-w":"5.5" x 95""}"

    Recreate the issue on https://swedishdoorco.com/ – sing up as a user, add items to cart and click save for later and inspect the console. You will see the errors I’m referring to.

    Let me know when you release a fix.

    Thanks,
    Greg

Viewing 1 replies (of 1 total)
  • Thread Starter themugician

    (@themugician)

    This was the log from the cookie
    woosl cookie raw: {“20072_20361”:{“product_id”:20072,”variation_id”:20361,”variation”:{“attribute_pa_height”:”30″,”attribute_pa_width”:”12″,”attribute_pa_paint-colours”:”cadet-grey”},”price”:138},”19194_19603″:{“product_id”:19194,”variation_id”:19603,”variation”:{“attribute_pa_height”:”30″,”attribute_pa_width”:”12″,”attribute_pa_paint-colours”:”amsterdam”},”price”:134},”36887_36892″:{“product_id”:36887,”variation_id”:36892,”variation”:”{“attribute_size-h-x-w”:”5.5″ x 95″”,”attribute_pa_thermofoil-colours”:”dusk”}”,”price”:91},”18756_19022″:{“product_id”:18756,”variation_id”:19022,”variation”:{“attribute_pa_height”:”30″,”attribute_pa_width”:”12″,”attribute_pa_paint-colours”:”chantilly-lace”},”price”:138},”18756_19109″:{“product_id”:18756,”variation_id”:19109,”variation”:{“attribute_pa_height”:”30″,”attribute_pa_width”:”12″,”attribute_pa_paint-colours”:”beau-green”},”price”:138},”26186_26187″:{“product_id”:26186,”variation_id”:26187,”variation”:”{“attribute_size-h-x-w”:”30″ x 30″”,”attribute_colour”:”Viau Off White”}”,”price”:461},”66857_67398″:{“product_id”:66857,”variation_id”:67398,”variation”:{“attribute_pa_height”:”11″,”attribute_pa_width”:”15″,”attribute_pa_paint-colours”:”decorators-white”},”price”:131},”69612_69687″:{“product_id”:69612,”variation_id”:69687,”variation”:{“attribute_pa_height”:”11″,”attribute_pa_width”:”15″,”attribute_pa_wood-species”:”walnut-veneer”},”price”:249}}


    After I deleted the woosl_products_pp cookies the issue went away

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.