Hi everyone, I have a corvid or Wix problem that maybe someone is aware of? I wrote some corvid code that appears to work on desktop (chrome) but NOT mobile. Is there something I’m doing wrong?
The code is for an Pay Now button. When the user clicks it, the item (Sneaker) in the repeater will go to the cart. I already created a product id in the “Stores/Products” database for the item (being pulled from the “Sneakers” database - both have the same id’s. On desktop, it works fine. On mobile, I don’t know what happens but I’ve attached the error code. I’ve attached my code as well. There are other things happening in the background (an email notification being sent through SendGrid, updating the “Sneakers” database) but based off of the error, it looks as if the _id in the “Stores/Products” database is not being found (even though it’s being found via Desktop and working just fine)
H
Here is the code:
$w(“#requestDisplaySenderTrader”).onClick( (event) => {
let $item = $w.at(event.context);
let desc = $item(‘#shoeTradeeId’).text;
console.log(“Shoe Id:” + desc);
if($item(“#senderStatusTrader”).label === “Accepted”){
wixData.query(“Stores/Products”)
.eq(“description”, desc)
.find()
.then( (results) => {
wixStores.getCurrentCart()
.then((cartData) => {
let cartId = cartData._id;
let cartLineItems = cartData.lineItems;
$item(‘#dataset2’).setFieldValue(“senderStatusTrader”, “Accepted”);
$item(‘#dataset2’).setFieldValue(“traderProductId”, results.items[0]._id);
$item(‘#dataset2’).setFieldValue(“traderCartId”, cartData._id);
$item(‘#dataset2’).save();
})
.catch((error) => {
console.log(error);
});
$w("#shoppingCartIcon1").addToCart(results.items[0]._id).then(() => {
wixLocation.to("https://www.houseoftradeinc.com/cart-page");
var tradeeName;
var tradeeEmail;
var traderEmail;
tradeeEmail = $item("#tradeeEmail").text;
traderEmail = $item("#traderEmail").text;
let body = {
"tradee_name": $item("#tradeeName").text,
"tradee_product_style": $item("#tradeeStyle").text,
"tradee_product_size": $item("#tradeeShoeSize").text,
"tradee_product_brand": $item("#tradeeBrand").text,
"tradee_product_condition": $item("#tradeeProductCondition").text,
"tradee_image": $item("#tradeeImage").src,
"trader_name": $item("#traderName").text,
"trader_product_style": $item("#traderStyle").text,
"trader_product_size": $item("#traderShoeSize").text,
"trader_product_brand": $item("#traderBrand").text,
"trader_product_condition": $item("#traderProductCondition2").text,
"trader_image": $item("#traderImage").src,
};
});
})
}
//////
if($item("#senderStatusTrader").label === "Declined"){
$item("#requestDisplaySenderTrader").hide();
$item("#requestDisplaySenderTrader").collapse();
}
////
//let desc = $item('#shoeId').text;
if($item("#senderStatusTrader").label === "Submitted"){
wixData.query("Stores/Products")
.eq("description", desc)
.find()
.then( (results) => {
$item('#dataset2').remove();
//$item('#dataset2').save();
console.log("Cancelled!");
wixLocation.to("https://www.houseoftradeinc.com/my-trades");
});
}
///
});
You can go to https://www.houseoftradeinc.com/
You’ll need to create an account, add a shoe ( https://www.houseoftradeinc.com/account/my-sneakers ), and then create another account to trade to and from. You can then go to browse ( https://www.houseoftradeinc.com/browse ) to trade the shoe from the other account you created. You will notice that it works on desktop, but not mobile.