Things were working fine until yesterday. But suddenly, the Add to Cart functionality was broken.
The following end point is giving us 404 No Route was found error.
https://www.lehmann-sa.com/wp-json/cocart/v1/add-item
Here is the error message to be precise:
{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}
The other end points are working fine.
For example, this end point is working as expected:
https://www.lehmann-sa.com/wp-json/cocart/v1/get-cart
All the plugins are up to date including CoCart and Woocommerce. We tried reverting back to an older version of CoCart, but no luck.
Here is the Javascript Code that used to work till yesterday:
function rest_api_cart() {
jQuery(document).off(
"click",
".product:not(.product-type-external) .single_add_to_cart_button:not(.add-to-cart-button-reject)"
);
jQuery(document).on(
"click",
".product:not(.product-type-external) .single_add_to_cart_button:not(.add-to-cart-button-reject)",
function (e) {
e.preventDefault();
var _this = jQuery(this);
var _product_id = _this.val();
var _form = _this.closest("form");
var _form_data = _form.serialize();
if (_product_id != "") {
var _data = "add-to-cart=" + _product_id + "&" + _form_data;
} else {
var _data = _form_data;
}
if (
_this.is(".disabled") ||
_this.is(".wc-variation-selection-needed")
) {
return false;
}
_data = "return_cart=false&" + _data;
jQuery("body,html").toggleClass("minicart-canvas-open");
jQuery(".nexio-minicart").addClass("is-adding-to-cart");
var atcUrl = "https://www.lehmann-sa.com/wp-json/cocart/v1/add-item";
jQuery.ajax({
type: "POST",
url: atcUrl,
data: _data,
dataType: "html",
cache: false,
headers: { "cache-control": "no-cache" },
success: function () {
jQuery(document.body).trigger("wc_fragment_refresh");
jQuery(document).on("added_to_cart", function () {
jQuery(".nexio-minicart").removeClass(
"is-adding-to-cart"
);
});
jQuery(".single_add_to_cart_button-clone")
.removeClass("loading")
.addClass("added");
},
});
}
);
}
Please let us know what you think. Any direction to fixing this problem would be helpful.
]]>I’d like to add a page (name and link) at the beginning of the blog posts trail, but not in the pages.
Can you help me out?
I have articles, listed under the category. Every post and category should be under “News”
Thanks
hfn
I am new to wordpress and I build my site locally. I discover your very good plugin and I try to use advanced slider. I add 2 or 3 items in the content section but it does’nt work (I adjust “slide to scroll”). All settings and effects work but just for the first slide. It’s like my other slides doesn’t exist.
Thanks in advance for your help.
For example:
There is an item called member fee of $10 for each member,
So How it can be added for 2 persons or 3 or ETC.
Thanks for any help.
When I try to add or edit an “Explore Event Listings” plugin, and I try to add a listing category via the “Add Item” button, nothing happens. When I look at my javascript console, I see an error that says “listing_id” not found.
A while back, I editing all of the listing categories, but at that time, I was able to work around to get the new categories to show up.
Can you help me determine the problem and solution? Thank you.
]]>Is there any chance that you could implement a warning, if there is a new item to be added, but “Add item” was not yet clicked?
]]>I’m using Multicurrency (Currency Switcher)
If I go to edit an order, and add a new item, the currency is based on whatever currency I select on the front-end, rather than the existing currency in that order.
EG an order is placed in GBP. My backend default is in GBP, but I have used the currency switcher on the frontend to select EURO.
When I go to edit the order (which is in GBP) the new item will be in EURO.
Suggest the currency should be based on whatever is already used in that order?
https://www.ads-software.com/plugins/woocommerce-jetpack/
]]>