0

Folks, I ran across the mentioned plugin but for some reasons if i do:

    var myCart = simpleCart({
            checkout: {
            type: "PayPal" ,
            email: "this.is@test.com"
            },
            currency: "USD",
            cartStyle: 'table'
    });

And then i try to use myCart.add() function for example i get a "TypeError: myCart.add is not a function":

            var newCartMe = myCart.add({
                name: cartTextT,
                price: cartPriceT,
                quantity: cartQtyT
            });

Just a note: if I do:

    console.log(myCart);

right before calling the add function I get the object returned just fine. Any idea on this? BTW is this project alive?

LordVee
  • 104
  • 1
  • 13

1 Answers1

0

Take a look at this:

simpleCart({
  checkout: {
    type: "PayPal" ,
    email: "this.is@test.com"
  },
  currency: "USD",
  cartStyle: 'table'
}).add({
  name: 'Awesome snickers',
  price: 100,
  quantity: 1
});

returns TypeError: undefined is not a function. You should not create simpleCart instance. Just use simpleCart object like this:

// Init
simpleCart({
  checkout: {
    type: "PayPal" ,
    email: "this.is@test.com"
  },
  currency: "USD",
  cartStyle: 'table'
})

And then add products:

// Add product
simpleCart.add({
  name: 'Awesome snickers',
  price: 100,
  quantity: 1
})

I don't know why that happens, that is very strange behavior, but it works ;)

18augst
  • 542
  • 7
  • 13