• Resolved 0xfib

    (@0xfib)


    Hello, I’m trying for weeks to find o solution for my problem. This is the closest I get. I want to use woocommerce ajax call but is not working with the WooCommerce Product Add-ons or I don’t do it right. The product is added to cart but i have error on cart page because my input variation field is required so is not working with out it.
    Can you tell me what i need to add in the data so when i run the javascript function its added with the product add-ons field.

    This is from network, i have no idea how to make a payload like by ajax

    ------WebKitFormBoundaryUlx95mk8GtLIn8He
    Content-Disposition: form-data; name="addon-101513[brand]"
    
    AEG
    ------WebKitFormBoundaryUlx95mk8GtLIn8He
    Content-Disposition: form-data; name="addon-101513[model]"
    
    9050
    
    ------WebKitFormBoundaryUlx95mk8GtLIn8He
    Content-Disposition: form-data; name="add-to-cart"
    
    101513
    ------WebKitFormBoundaryUlx95mk8GtLIn8He--

    This code is copyed from product page.

    <form class="cart" method="post" enctype="multipart/form-data">
    	 	<div class="required-product-addon product-addon product-addon-">
    
    			<h3 class="addon-name">. <abbr class="required" title="required">*</abbr></h3>
    
    	<p class="form-row form-row-wide addon-wrap-101513 brand ">
    					<label>Brand </label>
    				<input type="text" class="input-text addon addon-custom" data-price="" name="addon-101513[brand]" value="" disabled="">
    	</p>
    
    	<p class="form-row form-row-wide addon-wrap-101513 model ">
    					<label>Model </label>
    				<input type="text" class="input-text addon addon-custom" data-price="" name="addon-101513[model]" value="" disabled="">
    	</p>
    
    	<div class="clear"></div>
    </div><div id="product-addons-total" data-type="simple" data-price="0.5"></div>
    
    	 	<input type="hidden" name="add-to-cart" value="101513">
    
    	 	<button type="submit" class="single_add_to_cart_button button alt">Add to cart</button>
    
    			</form>

    https://www.ads-software.com/plugins/woocommerce-ajax-add-to-cart-for-variable-products/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Rishi Mehta

    (@rcreators)

    Hi,

    It will be good if you can provide demo url. Cause from this code i cannot generate exact situation. Plugin is only made for variable product and default variation in woocommerce. So if you are using something else plugin will break. But it can be use by making some changes in js.

    So if possible provide url to test and will guide you in proper direction.

    Thread Starter 0xfib

    (@0xfib)

    Plugin Author Rishi Mehta

    (@rcreators)

    HI,

    As i described, plugin is only for a variable products, you are using it for a simple product. For simple product, Woocommerce by default have ajax functionality which you need to tick in setting.

    https://prntscr.com/7930ft

    if its ticked and still ajax not working, that means woocommerce and woocommerce product addon have a issue. As Product addon is a premium plugin, i cannot do much about it but you can directly ask in support forum of wootheme if you bought it.

    Ajax for variable product plugin has nothig to do in this matther, you are trying to use it for wrong product type and so its not working.

    Thread Starter 0xfib

    (@0xfib)

    Thanks for directions! Best support ever, very fast! wow.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘js ajax function call – WooCommerce Product Add-ons’ is closed to new replies.