1

I have set up CT to use a Matrix for pricing on products. Everything is adding to cart and checkout is OK. I have allow_user_price on as it is a multi-lingual site and I need to show different prices.

No matter what I tweak, I can't get the inventory to reduce once a sale as gone through.

In my Matrix field I have the following:

  • option_value
  • inventory
  • uk_price
  • eu_price
  • us_price

I have also mapped inventory in to the name of he matrix field in products (pricing).

The multi_add_to_cart is wrapped round a bunch of products. When a customer clicks on more details, Jquery fetches the options - An EE template that loops through options.

Here is a highlight of the options:

{exp:cartthrob:item_options entry_id="{segment_6}" field="pricing"}
{options}
<input type="hidden" name="entry_id[{segment_6}{count}]" value="{segment_6}"/> 
<input type="hidden" name="item_options[{segment_6}{count}][option_value]" value="{option_value}"/>
<input type="hidden" name="item_options[{segment_6}{count}][size]" value="{size}"/>
<input type="hidden" name="item_options[{segment_6}{count}][pack]" value="{pack}"/>
<input type="text" id="cart-qty" name="quantity[{segment_6}{count}]" value="">

<button type="submit"  class="add_to_cart_submit btn btn-danger btn-small" >{phrase:add_to_cart}</button>
{/options}
{/exp:cartthrob:item_options}

I have omitted the price field and other styling for clarity.

Can anyone see if I am missing anything obvious?

1

It needs to reference the name of the field. option_value isn't the name of the field (I'd guess). So if your matrix field was called YOUR_FIELD_NAME_HERE, you'd add that as the option name. See example below.

<input type="hidden" name="item_options[{segment_6}{count}][YOUR_FIELD_NAME_HERE]" value="{option_value}"/>
2
  • Thanks Chris. Yeah, I got that from the docs. It is as labeled above.<br><br>The matrix table is called 'pricing' and the unique value for that row is called 'sku' with the short name of 'option_value'. <br><br>I've played with renaming this and it hasn't worked. – T2theC Feb 3 '14 at 12:45
  • For reference based on your feedback it should be thus: <input type="hidden" name="item_options[{segment_6}{count}][pricing]" value="{option_value}"/> Since you've suggested doesn't seem to work for you, I suggest you schedule a Phone/Skype appointment with the CartThrob/Mightybigrobot support team at support.mightybigrobot.com. A member of our support team can speak with your personally and will custom tailor a suitable solution to this issue. – Chris Newton Feb 3 '14 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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