Using EE 2.10.1 and Store v2.4.0 I need to get the value of a Store field out from a related entry. My code is currently this (abbreviated to make it easier to read):

{exp:channel:entries channel="products" limit="1"}   <!-- main product tag -->
  {exp:store:product_form}                           <!-- starts the form allowing multi add to cart submit -->
    {related_item}                                   <!-- opens tag pair for relationship field and loops related items -->
      {exp:store:product entry_id="{related_item:entry_id}" disable_form="yes"} <!-- output individual related item-->
        <p>{related_item:title} - {price}</p>        <!-- Really really want Store field access here! -->
      {exp:store:product}
    {/related_item}
  {/exp:store:product_form}
{/exp:channel:entries}

However I've tried any number of ways to get the price (or any other Store value) to show without any luck e.g.

{price}
{related_item:price}
{related_item:regular_price}
{related_item:store_field_name:price}

but so far no joy with anything. Is this even possible?!

up vote 0 down vote accepted

Have you tried putting the store item in an embed?

Sample template code

{exp:channel:entries channel="products" limit="1"}
  {related_item}
    {embed="_embed-template" the_id="{related_item:entry_id}"}
  {/related_item}
{/exp:channel:entries}

Then in the embed:

{exp:store:product entry_id="{embed:the_id}" disable_form="yes"}
  {title} - {price}
{/exp:store:product}

That should work...

  • Not entirely sure why but this seems to make things worse! This approach now isn't parsing the related field values i.e. {related_item:title}. It does send the entry_id through to the embed but the contents of the embed don't seem to be being parsed. Do I need to consider inward parsing somewhere? – Jos Medinger Sep 16 '16 at 16:29

OK - I am a little ashamed... I have found the answer and it was in my code all along... I enabled template debugging and it showed me that I hadn't closed the {exp:store:product} tag correctly (missed the slash) @bluedreamer - your code was spot on and also simplified the template a little too

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.