The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Blocking specific sku won't added in cart or checout

We pass the product added in cart using url

Foe ex :

How to block ABC1 product that not added in cart or redirect to my site home page..

Please give any suggestions..

  • brettbrett FoxyCart Team
    Hi @clickhere2shop. Are you wanting a specific product to simply never be added to the cart?

    You could approach that in a few ways, either blocking the cart at the template level or with a quick bit of javascript. You could add a bit of js to the template config header or footer to loop through the FC.json.items, find the offending product, remove it, and redirect. Would that make sense? If you need help figuring that out, let us know.

    To avoid this in the future, though, you could look at using the `expires` parameter:
    That'll ensure none of your cart links last longer than you might intend.
  • We tried passing JS like FC.json.items it did not work, Do you have a sample script that I can use. Please Suggest
  • fc_adamfc_adam FoxyCart Team

    The JSON object you can access from your FoxyCart store is read-only, sorry for the confusion there - you won't be able to make direct edits of the object.

    Instead what you'll want to do is make a JSONP request to the cart to update a product quantity. You can see details on that at - and as an example:
    var product_id = 0;
    for (var i = 0; i < FC.json.items.length; i++) {
    if (FC.json.items[i].code == "ABC1") {
    product_id = FC.json.items[i].id;

    if (product_id > 0) {
    FC.client.request('https://' + FC.settings.storedomain + '/cart?cart=update&quantity=0&id=' + product_id).done(function(dataJSON) {
    The above code will loop through the cart, trying to find one with a code of "ABC1". If it finds one, it then removes that from the cart and re-renders the page. You'll probably just want to do that on page load - so you can make use of our events to run in when the page is ready:
    FC.client.on("ready.done", function() {
    // Include code here
Sign In or Register to comment.