Add product / variation to cart with custom price.
-
Hello all,
Im trying to add a product to the cart via ajax with a custom price.
var cprice = 10.00; $.ajax({ url: WC_VARIATION_ADD_TO_CART.ajax_url, data: { "action" : "woocommerce_add_variation_to_cart", "product_id" : "1", "variation_id" : "4", "quantity" : 1, "variation" : { "price": cprice, }, type: "POST" } });
the price is calculated from a popup modal and then sent to a function that adds sends the variation to the cart. But ideally I want to send it via ajax with a custom price if possible.
- The topic ‘Add product / variation to cart with custom price.’ is closed to new replies.