php - WooCommerce - Force a selection in dropdown menu -
i'll try explain issue best can.
i have woocommerce pizza delivery website. people can log in , select pizzas want extras (olives, mushrooms, , such), , pick between junior size or normal size.
the extras checkboxes, must allowed pick different stuff.
the size dropdown menu, since have pick either one. normal size full price, junior size full price -1. price isn't showing unless pick 1 of 2 options.
the issue comes when visitors forget pick size. if forget so, , order, order goes through 0€.
i've tried millions of ways fix this, i'm stuck now. remaining idea force dropdown menu select 1 of options (normal size) upon loading page.
so drop down wouldn't "please pick one" right away "normal". visitors could, if wanted to, change junior, @ least if don't , order order go through full price , not 0€.
here code of dropdown menu:
<div ng-repeat="option in post.food track $index"> <div ng-if="option.type =='select' "> <label>{{option.title}}</label> <div ng-if="option.variation == 'yes'"> <select ng-model="option.selectedoption" ng-change="addselectoption( option , option.id , option.selectedoption , post.formoption , post.new_price )" ng-options="attr attr.text attr in option.options" ></select> </div> <div ng-if="option.variation == 'no' || !option.variation"> <select ng-model="option.selectedoption" ng-change="addselectoption( option , '', option.selectedoption , post.formoption , post.new_price )" ng-options="attr attr.text attr in option.options" > <option value="">please select</option> </select> </div> </div> </div>
there 2 choices, want force 1st choice ("normal").
1) possible?
2) can tell me how code i've shown here?
i'm desperate on one...
a better solution in situation use ajax , disabled submit button unless option selected dropdown menu except 'please select'. can achieve easyily ajax.
let me know if solves problem.
Comments
Post a Comment