Forum Replies Created

Viewing 15 replies - 1 through 15 (of 195 total)
  • Thread Starter mesmer7

    (@mesmer7)

    Hi @inpsydekrystian

    Thanks for the reply. And especially thanks for linking to the articles. Given that information, I’m going to leave the default behavior intact. As the first article mentions, the only real problem here was the surprise.

    Thread Starter mesmer7

    (@mesmer7)

    @architabasandrai20

    Update, turns out the code you gave me works fine. The conflict was caused by a blank line after the closing ?> must have been a consequence of the way I copied it from the forum to my plugin.

    But let me know here if the next update to the theme fixes the FAQ filter and I should delete this from my plugin.

    Thread Starter mesmer7

    (@mesmer7)

    Rank Math’s FAQ schema is only available to Pro users. I use the free version. I’ll just have to wait for the theme update.

    Thread Starter mesmer7

    (@mesmer7)

    @architabasandrai20

    Update: While the code you gave me worked for the schema, it caused a conflict with Rank Math sitemaps. Here is the discussion on the rank math support group.

    https://ww.wp.xz.cn/support/topic/the-site-map-no-longer-works-in-the-latest-version/#post-18873265

    Hi @rakibuzzamansiam1

    That helped. It wasn’t the config file, but a filter function that Kadence’s tech support gave me to patch a bug in the theme’s FAQ schema output.

    Unfortunately, I can’t narrow it down any further. The code contains a regex expression and an escape function I don’t really understand.

    Alright this is the 10th time I’ve asked an AI for a solution to this problem. And this is the 10th solution they’ve given me. This time, the AI told me enable WooCommerce Order Attribution and check for the session cookie by adding this to the htaccess file:

    #Block Add-to-Cart if the source-tracking cookie is missing (This identifies users who didn't 'land' on the site first)
    RewriteCond %{QUERY_STRING} (^|&)add-to-cart=[0-9]+ [NC]
    RewriteCond %{HTTP_COOKIE} !sbjs_session [NC]
    RewriteRule .* - [F,L]

    I’m also suddenly having a problem with my sitemaps, and I have no idea why. When I tried to view my sitemaps today, it shows the following error:

    This page contains the following errors:

    error on line 2 at column 7: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.

    https://www.hypnoticdreams.com/sitemap_index.xml (NSFW)

    Hi @lovingbro

    As difficult as it may be for Automatic to handle these issues at the application level. Think about how difficult it is for us ecommerce merchants. Remember, a lot of us are one-man operations.

    I’m a technical writer turned voice actor. I write, voice, and produce my audio recordings. I design my own cover art, I maintain my website and promote my products.In my list of skills, writing non-fiction is #1, coding is probably #10. I’m an amateur.

    I spent 3 months trying to find the code to block these bots. (three months NOT developing new products) And so far, I’m only 80% successful. My hosting service tech support was totally useless. I couldn’t find an answer on reddit or stackoverflow. And the AIs I asked for help made a ton of mistakes. People who have even less coding experience than me will go straight to an AI, ask for the code, and add it to their site, not realizing they could be adding additional problems.

    We need a better solution.

    • This reply was modified 1 month, 3 weeks ago by mesmer7.
    Thread Starter mesmer7

    (@mesmer7)

    @architabasandrai20

    Thank you. This works.

    Also ask your development team to research whether we should include <p> tags inside Answer schema. Might not need it if the Answer is only 1 sentence or 1 paragraph.

    Hi @shahzeenfarooq

    Given the scope of this forum, that’s perfectly understandable. But this is a serious security concern that affects ALL Woocommerce users. These bots are attacking every website they can find. We’d all appreciate it if Automatic would add cart security like this to Woocommerce core functionality.

    1. I’m going to need third-party confirmation before I add this to my site. Last time I tried something like this it disabled all the add-to-cart buttons, and locked me out of the site for an hour.
    2. WooCommerce’ Hand Picked products block doesn’t use AJAX. I had to add the following code to my site to compensate for this issue.
    3. I hate nested IF statements. Doesn’t anyone know how to use PHP’s Switch/Case Statement?

    add_action( 'wp_enqueue_scripts', 'hand_picked_block_ajax');

    function hand_picked_block_ajax() {
    // Only load this on the homepage to keep the site fast
    if ( is_front_page() ) {
    // Force the core WooCommerce AJAX scripts to load
    wp_enqueue_script( 'wc-add-to-cart' );
    wp_enqueue_script( 'wc-cart-fragments' ); // This fixes the "0 items" issue

    // The custom JS logic
    $custom_js = "
    jQuery(document).on('click', '.wc-block-handpicked-products .add_to_cart_button', function(e) {
    e.preventDefault();
    var \$button = jQuery(this);
    var product_id = \$button.data('product_id');

    if (!product_id) return;

    \$button.addClass('loading');

    jQuery.ajax({
    type: 'POST',
    url: wc_add_to_cart_params.ajax_url,
    data: {
    action: 'woocommerce_ajax_add_to_cart',
    product_id: product_id
    },
    success: function(response) {
    if (response.error && response.product_url) {
    window.location = response.product_url;
    return;
    }
    // Trigger the fragment refresh so the mini-cart updates
    jQuery(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, \$button]);
    \$button.removeClass('loading').addClass('added');
    }
    });
    });
    ";

    // Attach this script to the 'wc-add-to-cart' handle
    wp_add_inline_script( 'wc-add-to-cart', $custom_js );
    }}

    Thread Starter mesmer7

    (@mesmer7)

    @architabasandrai20 Hi Archita,

    I recently read about sanitizing tags, and I figured that’s what you’re doing. But the neither code you gave me nor the code on that documentation page solve the problem. Kadence is stripping the href attribute from the <a> tag in the Answer schema. I want to keep this attribute in the schema.

    mesmer7

    (@mesmer7)

    I’ve been dealing with this attack for three months now. Every day a botnet (rotating IPs) crawls (or hits) 20-30 add-to-cart buttons across my site. Most of them never view a page, but go directly to the add-to-cart. In addition another bot triggers two to three remove_items from the cart. These bots create 20-30 shopping carts every day without ever completing a purchase.

    I’ve tried a dozen different configurations for the htaccess file and finally settled on the code below. It reduces the server load, but the attack continues.

    RewriteCond %{QUERY_STRING} (^|&)add-to-cart=[0-9]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !googlebot [NC]
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} !^www.hypnoticdreams.com$ [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} (bot|crawl|spider) [NC,OR]
    RewriteCond %{HTTP_REFERER} \?.(^|&)add-to-cart=[0-9]+(&|$) [NC,OR] RewriteCond %{HTTP_REFERER} ^$ [NC] RewriteRule . - [E=blockbot:1,F,L]

    I finally signed up for quic.cloud’s CDN and enabled UNDER ATTACK mode. It seems to be blocking the attack for now, but it really, really slows down the add-to-cart function when I test it.

    Thread Starter mesmer7

    (@mesmer7)

    @litetim It can’t be the theme, I sent a report last month without a problem while the same theme was active. It has to be either All In One Security (I switched from Wordfence) or quic.cloud CDN’s (just signed up) security settings. Those are the only two things I’ve changed since I successfully sent a report last month.

    Thread Starter mesmer7

    (@mesmer7)

    @litetim The report tool still isn’t working. I disabling AIOS’s firewall. When that didn’t fix the problem, I went into quic.cloud’s CDN security and disabled Block WP API Embed, waited 10 minutes and tried to send it again. But that didn’t fix it either. I continue to see Failed to request via WordPress: [server] https://api.quic.cloud [service] wp/report when I try to send a report.

Viewing 15 replies - 1 through 15 (of 195 total)