Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author mra13

    (@mra13)

    As long as you can add the following to the form that you are creating you should be fine:

    onchange="ReadForm (this.form, false);"

    It is basically calling a JavaScript function named “ReadForm”

    Thread Starter klarabara

    (@klarabara)

    Thankyou, I was hoping it would be that easy!

    Out of curiousity:
    Do I need to make my edits in the plugin-file or is this something I can put in my functions-file, for future updates I mean?

    *starstruck*

    Thread Starter klarabara

    (@klarabara)

    Still cant get it to work and I think it is partly because this new dropdown button needs to also be the submit-button?

    Also I get this error in the console:
    TypeError: ‘undefined’ is not an object (evaluating ‘obj1.length’)

    This is the output of my button:

    <div class="wp_cart_button_wrapper btn">
    	<form method="post" class="wp-cart-button-form" action="" style="display:inline" onsubmit="return ReadForm(this, true);">
    		<div class="btn-group">
    			<a name="variation1" onchange="ReadForm(this.form, false);" class="btn dropdown-toggle" data-toggle="dropdown" >Add to cart <span class="caret"></span></a>
    			<ul class="dropdown-menu">
    				<li><a value="S ">S </a></li>
    				<li><a value=" M "> M </a></li>
    				<li><a value=" L"> L</a></li>
    				</ul>
    				</div>
    				<br />
    
    				<input class="btn" type="submit" value="Add to Cart" />
    				<input type="hidden" name="product" value="En helt ny" />
    				<input type="hidden" name="price" value="14" />
    				<input type="hidden" name="product_tmp" value="En helt ny" />
    				<input type="hidden" name="shipping" value="10" />
    				<input type="hidden" name="cartLink" value="https://localhost/wordpress/shop-merchandise/" />
    				<input type="hidden" name="addcart" value="1" />
    		</form>
    </div>

    If I add a normal button below to submit it sends without the variation..

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘"dropdown-button" with variations’ is closed to new replies.