Cannot add to cart using $cart->add() with custom field after update to VM4

Started by datalynk, December 05, 2023, 20:39:48 PM

Previous topic - Next topic

datalynk

Hi,

We have a working system with Virtuemart 4 where we can add to cart using $cart->add() with an additional participant ID.
When we update to Joomla 4 this stops working.
I have a working Ajax method that does kinda work, but I cannot see how to add the custom field information in the Ajax call...

Here is the link with the test "Test Add to Cart Button" (works but don't know how to add the custom field value for the product).
https://staging2.usasportsgroup.com/program?pid=95933&site=usg

Here is the code for the Ajax call...


<p><button id="dtaddtocart">Test Add to Cart Button</button></p>
            <script>
            $('#dtaddtocart').click(function() {
                  var data = "quantity[]="+1+"&virtuemart_product_id[]="+95933+"&participant[30]=102888";
                  $.ajax({               
                    type: "GET",
                    dataType: 'json',
                    url: "https://staging2.usasportsgroup.com/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS",
                    data: data,
                    success: function(data) {
                        alert('Success');
                        console.log(data.status);
                        console.log(data.msg);
                        getCart();
                    }
                  });
                });
</script>