php - Add to cart in woocommerce -
I am trying to add a cart function to a cart which is linked to the cart page I have written the following code
simple.php
& lt; form class = "cart" method = "post" onSubmit = "return validateIn ( '& lt ?? = $ Products & gt ;? id & gt;');" enctype = 'multipart / form-data' & gt; & Lt ;? Php do_action ('woocommerce_before_add_to_cart_button'); ? & Gt; & Lt ;? Php if (! $ Products & gt; Ais_ol_aind personally ()) woocommerce_quantity_input (array ( 'min_value' = & gt; Lagu_filtr ( 'woocommerce_quantity_input_min', 1, $ product), 'max_value' = & gt; apply_filters ( ' Woocommerce_quantity_input_max '$ product- & gt; backdoors_edicated ()?' ': $ Product-> get_stock_quantity (), $ product))); ? & Gt; I followed by the animation Add to cart I'm trying to add code to add to cart
function validateIn (p_id) { / Code for animation event Prebundance default (); Like addToCart (p_id); return false; } Function addToCart (p_id) {jQuery.ajax ({type: 'POST', url: 'addtocart.php', data: { 'product_id': p_id,}, success: function (response, text position, jqxhr) {Console Log ("product added");}}); } Can anyone tell me how to move forward! Pls help
The PHP page Ajax URL page,
global $ Woocommerce; $ Woocommerce- & gt; Cart- & gt; Add_to_cart ($ product_id);
Comments
Post a Comment