2

Is there a conditional to check if a modifier has been chosen? I am trying to create a notification to inform the user the need to choose a modifier before trying to add the product to their cart.

0
2

I don't know if there is a variable you can use in a conditional.

But this would be easy to accomplish with jQuery. When the Add To Cart button is clicked, first check to see if a modifier is selected... if one isn't selected you can Alert your message so show an error on the page as needed.

7
  • Thanks Anna, was hoping there would be a simple conditional i could use... not much of a jquery/javascript programmer :(. – tcherokee Aug 8 '13 at 16:26
  • If a variable isn't mentioned in the docs, I'd say a conditional isn't doable. This is very easy to do with jQuery... no time like the present to start learning it. It's invaluable as a web dev to have it as a tool. Post a screenshot of your page and the relevant html somewhere and I can help point the way. – Anna_MediaGirl Aug 8 '13 at 16:41
  • Let's use jsfiddle.net to get it working... Post your html there please for the modifier dropdown and the add to cart button... and post a screenshot or a link to the actual page. – Anna_MediaGirl Aug 8 '13 at 16:42
  • Hello Anna, Thanks for taking the time out to help :). Here is the JSFiddle link – tcherokee Aug 8 '13 at 17:01
  • Here is a working version that shows a JS alert. This will get you started: jsfiddle.net/TdhkS/3 – Anna_MediaGirl Aug 8 '13 at 20:44
0

Not sure if this will help. I'm using something similar to grab the value of a selected modifier. It checks for a modifier value. While I haven't tested it, it should return whatever message you want if no modifier_value is found.

{exp:store:checkout}
{items}
{exp:channel:entries entry_id="{entry_id}"}
  {modifiers}
    {if "{modifier_value}" == ""}
    Message or code that you want the user to see.
    {/if}
  {/modifiers}
{/exp:channel:entries}
{/items}
{/exp:store:checkout}

Hope that helps.

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.