• Resolved iamahmedq

    (@iamahmedq)


    I am receiving an error in console log 404 not found. It seems like the error is here.

    l.send(i.hasContent && i.data || null), s = function(t, n) {
    full code around the function.

      if (i.username ? l.open(i.type, i.url, i.async, i.username, i.password) : l.open(i.type, i.url, i.async), i.xhrFields)
                        for (a in i.xhrFields) l[a] = i.xhrFields[a];
                    i.mimeType && l.overrideMimeType && l.overrideMimeType(i.mimeType), i.crossDomain || n["X-Requested-With"] || (n["X-Requested-With"] = "XMLHttpRequest");
                    try {
                        for (a in n) l.setRequestHeader(a, n[a])
                    } catch (t) {}
                    l.send(i.hasContent && i.data || null), s = function(t, n) {
                        var a, h, c, u;
                        try {
                            if (s && (n || 4 === l.readyState))
                                if (s = e, r && (l.onreadystatechange = ut.noop, K && delete U[r]), n) 4 !== l.readyState && l.abort();
                                else {
                                    u = {}, a = l.status, h = l.getAllResponseHeaders(), "string" == typeof l.responseText && (u.text = l.responseText);
                                    try {
                                        c = l.statusText
                                    } catch (t) {
                                        c = ""
                                    }
                                    a || !i.isLocal || i.crossDomain ? 1223 === a && (a = 204) : a = u.text ? 200 : 404
                                }

    Error page: VM5253:2922 GET https://www.tamaraisrael.co.il/shop/shopping-bag?_=1575416488697 404

    Any help would be appreciated.
    Thanks
    Ahmed Q.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support wpnomad a11n

    (@wpnomad)

    Hi @iamahmedq ,

    This sounds like a conflict coming from the installed theme or one of the plugins. Please conduct a conflict test as mentioned here: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    That should help you figure out the conflicting theme/plugin.

    Thread Starter iamahmedq

    (@iamahmedq)

    Thank you @wpnomad,

    I tested with all plugins and themes and the issue is with ACF pro and Yoast SEO.
    I dunno what to do.

    Meanwhile, we are on woo topic, can you tell me where I am making a mistake. My code throws an error. All I want to do is to wrap content inside span and attach a woo built in class which is in this case on-sale.

    My code is here.

    add_filter('woocommerce_sale_flash', 'woocommerce_change_sale_to_percentage', 10, 3);
    
    function woocommerce_change_sale_to_percentage($content, $post, $product){
    
    if (!$product->is_in_stock()) return;
    
    $sale_price = get_post_meta($product->id, '_price', true);
    
    $regular_price = get_post_meta($product->id, '_regular_price', true);
    
    if (empty($regular_price)) { //then this is a variable product
    
    $available_variations = $product->get_available_variations();
    
    $variation_id = $available_variations[0]['variation_id'];
    
    $variation = new WC_Product_Variation($variation_id);
    
    $regular_price = $variation->regular_price;
    
    $sale_price = $variation->sale_price;
    
    }
    
    $sale = ceil((($regular_price - $sale_price) / $regular_price) * 100);
    
    if (!empty($regular_price) && !empty($sale_price) && $regular_price > $sale_price){
    
    $content = '<span class="onsale"> . '-' . $sale . '%' </span>';
    
    }
    
    return $content;
    
    }
    Plugin Support Thu P. a11n

    (@thup90)

    Hi @iamahmedq,

    I tested with all plugins and themes and the issue is with ACF pro and Yoast SEO.
    I dunno what to do.

    As we don’t provide support for third-party plugins, I’d suggest reaching out to the plugins’ developers for further help with this.

    My code throws an error. All I want to do is to wrap content inside span and attach a woo built in class which is in this case on-sale.

    We supports are not developers and with fairly complex customizations like this, I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    2. Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add to cart 404’ is closed to new replies.