Ajax add to cart creating new cart !

New Member
1 0 0

I'm trying to add a product with some properties from my custom site using the code below, It works fine but when someone enters the page with some items in the cart and then use the custom page the ajax code add the product to a new cart, not the current cart.






    function checkouturl(){

    myshopify_domain = "****.myshopify.com";
    checkout_url= "https://checkout.rechargeapps.com/r/checkout?myshopify_domain="+myshopify_domain+"&cart_token="+token
    if (token == "")return "";
    return checkout_url;
  data = {
      "id": id.toString(),
      "quantity": 2,
      "properties": {
      type: 'POST',
      url: '/cart/add.js',
      data: data,
      dataType: 'json',
      async: false,
      success: async function (data){
             window.location.href = checkouturl(); 





 here is how it is supposed to work.

the user enters some data in fields in my custom page then on button click the script should add the product with properties then redirect to checkout (Here I'm using recharge checkout).


Replies 0 (0)