The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Get value of custom product attributes?

I can add custom product attributes such as &color=green&size=XXL as documented here:

Is there a way to extract the values of these custom attributes with FC.json? For example, I can get price, code and weight of the first item in the cart with:


But FC.json.items[0].color doesn't work.
  • This is for use with live rate shipping modifications by the way.
  • fc_adamfc_adam FoxyCart Team

    Good question. Any custom attributes for a products will be accessible within FC.json.items[0].options - which is an array of the options which you can loop through to find the one you're after. Also for reference, you can explore the JSON by outputting FC.json in your browser's console when you're on the cart or checkout - and you'll be able to then see the structure of the information.
  • Thanks. that seems to work. If anyone else is interested, the code looks something like this:

    for (var j = 0; j < FC.json.items[0].options.length; j++) {
    this_class = FC.json.items[0].options[j].class;
    this_name = FC.json.items[0].options[j].name;
    this_value = FC.json.items[0].options[j].value;
Sign In or Register to comment.