0

I am noob with structured data implementation and don't have any code knowledge. I have been looking for a week how to solve a warning with price in Google structured data testing tool.

My prices are with a comma which is not accepted by Google. By checking the http://schema.org/price it tells me that "Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a decimal point. Avoid using these symbols as a readability separator."

I have a CSS variable element #PdtPrixRef named in a variable "Product-price" with a comma "12.5" but I can't find how to replace it in my structured data with the value "12.5"... Someone to help me?

Hereafter my actual script :

My actual GTM script

Should I add something to my script or making an VARIABLE (Custom Js)? I think it's something like

value.replace(",", ".")

But I do't know how to write the full proper function from beginning to end...

1
  • Side note: terms are case-sensitive, so it should be price (instead of Price) in your JSON-LD script. Commented Aug 4, 2022 at 9:36

1 Answer 1

0

Yes you can just create a Custom JavaScript Variable

enter image description here

Here is the code

function(){
    var price = {{Product-price}};
    return price.replace("," , ".");
}

Then using this variable to your JSON-LD script.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.