Skip to content

richSnippet SKU with double-quote #38

@perryholden

Description

@perryholden

Issue description

When configurable product SKUs have double-quotes in them (although I realize double-quotes in SKUs are not ideal, that is what exists), then the richSnippet JS breaks. See screenshot below.

I think the most ideal solution would be to replace the double-quotes in the SKU data attribute in \Reviewscouk\Reviews\Block\Richsnippet::getRichSnippet with "template literals" (backticks). This is already done with the description.

If this is an acceptable solution, I can create a PR. Thanks.

Steps to reproduce the issue

  1. Create a configurable product with a SKU that contains a double-quote.
  2. Navigate to that PDP.

What's the expected result?

  • No JS errors

What's the actual result?

  • The following JS error shows in the console:
Uncaught SyntaxError: Unexpected token ';' (at sample-url:2347:323)

Additional details / screenshot

  • Screenshot
  • Screenshot 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions