Support » Plugin: Woocommerce Ajax add to cart for variable products » Is not generic and will not work with other plugins

  • If you have plugins adding fields on the variation form, they will not be saved in the cart..

    The js is not generic at all and only selects specific fields rather than serializing the form and sending it, resulting in data loss

    It is also using $product->id rather than $product->get_id() which has been deprecated by WC and will throw you a nice warning

    It is using echo json_encode(...); die; rather than wp_send_json(...)

    Hint, what you want in the js side is this :

    var data = {
    	action: 'woocommerce_add_to_cart_variable_rc',
    $variation_form.serializeArray().map(function (attr) {
    	if ( !== 'add-to-cart')
    		data[] = attr.value;

    Instead of this

    var data = {
    	action: 'woocommerce_add_to_cart_variable_rc',
    	product_id: product_id,
    	quantity: quantity,
    	variation_id: var_id,
    	variation: item
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author rcreators



    Thanks for your review. Basically plugin works with variation as it’s in the name. People have built thousands of plugin for extra fields. So I cannot check everything and add support. This plugin is around 7-8 years sold may be and only built to do specific task to add variation through Ajax which it do. So plugin is not generic, it’s only work with variation.

    Now as you also posted few code hint, did you find it works or not ? Cause if I send all form data through Ajax, how I am going to manage variation and other field data which are added by different plugin ? Because this data just not go to cart directly by sending through Ajax, they need to add into cart object as well.

    Let me know when you find that solution, I will be happy to implement your suggestions. Make sure you understand that every plugin have different type of data. So consider that as well.

    Rishi Mehta



    Hello! Your plugin is really nice, but it doesn’t work with variable products, that used plugin WooCommerce Advanced Quantity. That products doesn’t add to cart. Can you help me with this problem?

    Plugin Author rcreators


    Hello @tofandel

    Please check now. I have implemented code you suggested and made adjustment on php code accordingly to send data to WooCommerce adding to cart function.

    Check now and let me know if its solve issue for you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this review.