Wix Forum Logo
  • Community Forum

  • Support

  • Members

  • Groups List

  • Blog

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    Kishoraditya Chaudhari
    Mar 18, 2020

    Issue with adding to cart

    in Forum Discussions

    I keep getting this error. I have referred to the forums and documentation on wix itself. But isn't any more info or maybe i am misreading the info. Although it would be great if anyone could help me figure out this!

    FetchError: {"code":"CANNOT_ADD_CART","commandName":"AddToCart","message":"option Fabric for product with id 9b74bf6b-6288-66a3-e317-07f9d83e76ac is required","field":""}

    So, I have added a regular button, changed its ID to #addToCardButton.

    #pdtId is a hidden text box on page with the id of the product on DYNAMIC page

    selectedOptions{}, is where I have stored my dynamic values, which I needed to be added to cart along with the product when the user selects it.

    export function addToCartButton_click(event) {
    //$w('#shoppingCartIcon1').addToCart(productId, 1, {choices: selectedOptions});
    
    let d = $w('#pdtId').text;
    $w('#shoppingCartIcon1').addToCart(d, 1, {"options": {choices: {"Fabric": "selectedOptions[1]","Button": selectedOptions[2], "Color": selectedOptions[3],"Zip": selectedOptions[4]}},})
    .then( () => {
    console.log("Product added");
    } )
    .catch( (error) => {
    console.log(error);
    } );
    }

    Overall, I am just trying to add certain customization options to products on my website which I wasn.t able to add through wix store, So I created dynamic page, linked everything but adding to cart isnt working, normal add to cart button (the one provided by wix) links to normal page's add to cart page and cannot be changed, also it needed to added product specific. And I guessed the first commented line only would be enough, it would be great if you can tell why it isnt.

    Thanks in advance for anything that could be of help.

    9 answers0 replies
    0
    9 Comments

    Share Your ThoughtsSign up to leave a comment.

    sarimm53
    Feb 13

    I am having the same issue on my site but after restarting my wix site, its start working fine.


    1

    rayansufian
    Oct 03, 2021

    Hi I am trying to implement add to cart button my website but getting FetchError. Can you please help me what is the issue? Thanks.

    1

    W
    Water Proof
    Jul 14, 2020

    How can I integrate it in my new site? I want to migrate my website to wix. Please help me.

    1
    K
    Kishoraditya Chaudhari
    Jul 14, 2020
    Replying to

    What exactly do you want to integrate in your new site? I don't think there is any easy way like one click migration available as of now, you will have to build it using wix first.

    Like

    J
    JEFFERYWORD UWAGBOE
    Mar 18, 2020

    My friend please am sorry I couldn't get useful information for you.

    1

    J
    JEFFERYWORD UWAGBOE
    Mar 18, 2020

    Ok try it and let see okay

    1
    K
    Kishoraditya Chaudhari
    Mar 18, 2020
    Replying to

    It doesn't

    Like

    F
    Fospk
    Mar 18, 2020

    I think try restarting the wix site then try to get a vpn like tunnelbear free. I dont know if this works

    1
    K
    Kishoraditya Chaudhari
    Mar 18, 2020
    Replying to

    If you are concerned about the browser or server cache, I saved closed and restarted, the output is still not working and giving same error. I do not understand how changing VPN will work for wixsites, do let me know about it, and also the actual issue :)

    Like
    9 comments
    Similar Posts
    • Issue with adding wix-location API to export function code
    • Issue adding items to a paid plan + ideas for the paid plans
    • pobleme shopping cart

    WIX FORUM

    Create an online community right on your site with Wix Forum. Your visitors can become members, join conversations, follow posts, leave comments and more. Plus, you can choose from beautiful layouts and customize to get the look you love. And it’s completely free! 

     

    © 2006 - 2020 Wix.com, Inc 

    COMPANY

    About Wix

    Terms of Use

    Privacy Policy

    SUPPORT

    Help Center

    Contact Us

    ​

    • Black Facebook Icon
    • Black Twitter Icon
    • Black YouTube Icon
    • Black Pinterest Icon
    • Black Instagram Icon
    • Black LinkedIn Icon