I'm having an issue trying to get the inventory value for products loaded into a package. As far as I can see I have all the correct set up done, I can add a package and products to the cart - and can checkout with the correct products.

I have given the item_options modifier a data-stock attribute so I can check against this using JS and display a message if the item is out of stock. This works on a regular product channel but for some reason the {sub:inventory} tag is spitting out a really long random string. Any ideas what may be going on? Below is my item_options block which is inside a {packages_packages} tag.

{exp:cartthrob:item_options entry_id="{entry_id}" row_id="{sub:row_id}"}
{if dynamic}
  <label class="control-label" for="{option_field}">{option_label}</label>
{if options_exist}
{if allow_selection}
  <label class="control-label" for="{option_field}">{option_label}</label>
    <div class="controls">
{select class="chosen-size-select"} 
{if option_first_row}
  <option selected value="">Please select a size</option>
  <option {selected} value="{option_value}" data-stock="{sub:inventory}" data-option-price="{if option_price_numeric != 0}{option_price_numeric}{/if}">
  {option_name}{if option_price_numeric != 0} +{option_price_numeric}{/if}

URL for the result is here: http://oyumoyu.com/shop/outfit/outfit-01


Your Answer

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

Browse other questions tagged or ask your own question.