Forum Replies Created

Viewing 15 replies - 1 through 15 (of 388 total)
  • Thread Starter MDC2957

    (@mdc2957)

    When you click add to cart on a woo product page, it slides out the side cart without reloading the page.

    What I found is this: ?add-to-cart=productID&quantity=1#cfw-cart It’s not 100% perfect because it reloads the page first, and then it slides out the side cart. I’m not sure how to make a regular button function like the built in add to cart button where it slides out without reloading the page.

    Thread Starter MDC2957

    (@mdc2957)

    For anyone else who runs into this, and is using WP Rocket, the cause for me was using the “load javascript deferred” option in WP Rocket. To fix it, you need to add this line to the exclusions box:

    \/jquery(-migrate)?-?([0-9.]+)?(.min|.slim|.slim.min)?.js(\?(.*))?( |'|"|>|$)

    Thread Starter MDC2957

    (@mdc2957)

    I sent it to you via your contact form again

    Thread Starter MDC2957

    (@mdc2957)

    I have to revive this thread because I was just testing a new Elementor form, Brave shields are disabled and I’m getting the Spamming or your Javascript is disabled !! when I submit the form. Now I don’t know what to do as I thought the Brave shields are what was causing the problem before…? I tried clearing wp rocket, cloudflare and cloudways hosting caches, still getting the error =(

    • This reply was modified 2 months, 1 week ago by MDC2957. Reason: added that I cleared all caches
    Thread Starter MDC2957

    (@mdc2957)

    I ditched this plugin altogether and went with WP Armour which seems to be working well; haven’t gotten any comment spam as of yet!

    Thread Starter MDC2957

    (@mdc2957)

    I finally discovered the cause of the problem. I’m using Brave browser and the shields were activated and they were causing some issue, not entirely sure what, but after I turned the shields off on the site, I was able to submit the elementor form with your plugin active. Sorry about that, maybe you can add that tip to your instructions in case others run into the issue…

    Thread Starter MDC2957

    (@mdc2957)

    I noticed I still had Turnstile activated, so I deactivated that, and I cleared WP rocket cache, and purged cloudflare cache. Tried to submit the form in a private browsing window and still got the spam message. I checked the console and I do see this error:

    Uncaught ReferenceError: jQuery is not defined at wpa.js?ver=1735662989:1:64

    Thread Starter MDC2957

    (@mdc2957)

    ok, will do that first thing tomorrow morning. I tend to think that it’s not WP rocket because that cache gets cleared pretty frequently such as when updating plugins, e.g. installing your plugin, deactivating and reactivating it. So maybe it’s cloudflare then. I will let you know, thanks.

    Thread Starter MDC2957

    (@mdc2957)

    which cache? Browser? WP Rocket? Cloudflare? Web server? Whether it’s cached or not, shouldn’t it work? Cached just means it doesn’t need to be downloaded right?

    Thread Starter MDC2957

    (@mdc2957)

    No, not that I know of. If it was disabled, a lot of stuff would not work such as elementor itself?? Also, what about the fact that it worked when I was signed in as the administrator?

    • This reply was modified 2 months, 4 weeks ago by MDC2957.
    Thread Starter MDC2957

    (@mdc2957)

    I am using wp rocket, and followed the instructions in the other thread that I saw. Did another test this morning. When I load the site while logged in as admin, I see the act as spam bot window below the form. I submit the form and it goes through. Then I load the site in a private browsing window, I view the page source and I see the wpa.js is there. I submit the same form and I get the spamming message. So it works while logged in as admin, but it doesn’t work while logged out, which is of course a problem because everyone who visits my website is logged out. I sent my URL to you via your contact form on your website..

    MDC2957

    (@mdc2957)

    I’ve also just discovered problems that seem to trace back to Turnstile. I’m using a plugin called CheckoutWC and with Turnstile plugin activated, the checkout form doesn’t load at all, and I have trouble adding items to the cart. I know it’s Christmas, but is there a fix for this yet?

    Thread Starter MDC2957

    (@mdc2957)

    I asked chatgpt and it said this:

    To determine if the custom WooCommerce webhook creates the same payload as the built-in “order created” webhook, we need to compare the payload structures and data they send.

    Here’s the built-in “order created” webhook payload structure:

    {
      "id": 123,
      "parent_id": 0,
      "status": "processing",
      "order_key": "wc_order_1234567890abcdef",
      "number": "123",
      "currency": "USD",
      "version": "5.1.0",
      "prices_include_tax": false,
      "date_created": "2021-04-06T13:17:50",
      "date_created_gmt": "2021-04-06T17:17:50",
      "date_modified": "2021-04-06T13:17:50",
      "date_modified_gmt": "2021-04-06T17:17:50",
      "discount_total": "0.00",
      "discount_tax": "0.00",
      "shipping_total": "10.00",
      "shipping_tax": "0.00",
      "cart_tax": "0.00",
      "total": "60.00",
      "total_tax": "0.00",
      "customer_id": 2,
      "order_currency": "USD",
      "meta_data": [],
      "line_items": [],
      "tax_lines": [],
      "shipping_lines": [],
      "fee_lines": [],
      "coupon_lines": [],
      "refunds": [],
      "payment_method": "bacs",
      "payment_method_title": "Direct Bank Transfer",
      "transaction_id": "",
      "customer_ip_address": "127.0.0.1",
      "customer_user_agent": "Mozilla/5.0",
      "created_via": "checkout",
      "customer_note": "",
      "date_completed": null,
      "date_paid": null,
      "cart_hash": "",
      "number": "123",
      "meta_data": [],
      "_links": {
        "self": [],
        "collection": []
      }
    }

    Now let’s look at the custom webhook code from the provided link:

    <?php
    add_action( 'woocommerce_thankyou', 'custom_order_created_webhook', 10, 1 );
    function custom_order_created_webhook( $order_id ) {
        $order = wc_get_order( $order_id );
    
        $webhook_payload = array(
            'id' => $order->get_id(),
            'parent_id' => $order->get_parent_id(),
            'status' => $order->get_status(),
            'order_key' => $order->get_order_key(),
            'currency' => $order->get_currency(),
            'version' => $order->get_version(),
            'prices_include_tax' => $order->get_prices_include_tax(),
            'date_created' => $order->get_date_created()->date('Y-m-d\TH:i:s'),
            'date_created_gmt' => $order->get_date_created()->date('Y-m-d\TH:i:s\Z'),
            'date_modified' => $order->get_date_modified()->date('Y-m-d\TH:i:s'),
            'date_modified_gmt' => $order->get_date_modified()->date('Y-m-d\TH:i:s\Z'),
            'discount_total' => $order->get_discount_total(),
            'discount_tax' => $order->get_discount_tax(),
            'shipping_total' => $order->get_shipping_total(),
            'shipping_tax' => $order->get_shipping_tax(),
            'cart_tax' => $order->get_cart_tax(),
            'total' => $order->get_total(),
            'total_tax' => $order->get_total_tax(),
            'customer_id' => $order->get_customer_id(),
            'order_currency' => $order->get_currency(),
            'payment_method' => $order->get_payment_method(),
            'payment_method_title' => $order->get_payment_method_title(),
            'transaction_id' => $order->get_transaction_id(),
            'customer_ip_address' => $order->get_customer_ip_address(),
            'customer_user_agent' => $order->get_customer_user_agent(),
            'created_via' => $order->get_created_via(),
            'customer_note' => $order->get_customer_note(),
            'date_completed' => $order->get_date_completed() ? $order->get_date_completed()->date('Y-m-d\TH:i:s') : null,
            'date_paid' => $order->get_date_paid() ? $order->get_date_paid()->date('Y-m-d\TH:i:s') : null,
            'cart_hash' => $order->get_cart_hash(),
            'line_items' => array(),
            'tax_lines' => array(),
            'shipping_lines' => array(),
            'fee_lines' => array(),
            'coupon_lines' => array(),
            'refunds' => array()
        );
    
        $webhook_url = 'https://example.com/webhook';
        $response = wp_remote_post( $webhook_url, array(
            'method' => 'POST',
            'body' => json_encode( $webhook_payload ),
            'headers' => array(
                'Content-Type' => 'application/json'
            )
        ));
    }
    ?>

    The custom webhook payload is constructed using data from the WooCommerce order object, similar to the built-in webhook. However, a few differences exist:

    1. Field Differences:
    • The custom webhook includes ‘number’ within ‘webhook_payload’.
    • The built-in webhook includes ‘_links’ which is missing from the custom webhook.
    1. Data Formatting:
    • Dates in the custom webhook are formatted explicitly using the date('Y-m-d\TH:i:s') format, ensuring proper datetime formatting.
    1. Empty Arrays:
    • ‘meta_data’ in the built-in webhook is an empty array, but the custom webhook does not include it in ‘webhook_payload’.
    • ‘line_items’, ‘tax_lines’, ‘shipping_lines’, ‘fee_lines’, ‘coupon_lines’, and ‘refunds’ are included as empty arrays in the custom webhook. In contrast, these fields are included as empty arrays in the built-in webhook if there is no data.

    To summarize, while the custom webhook is similar in structure to the built-in “order created” webhook, there are slight differences in fields and data formatting. Specifically, the custom webhook is missing the ‘_links’ field and includes the ‘number’ field twice. Other fields such as ‘meta_data’ and arrays like ‘line_items’, ‘tax_lines’, etc., are included but empty.

    For complete parity, you would need to ensure all fields match exactly, including the ‘_links’ field and ensure no duplicate fields are present.

    Thread Starter MDC2957

    (@mdc2957)

    Can you tell me from looking at the code in that custom order completed webhook that I linked to if it delivers the same payload as the built in core “order created” webhook? If it does, then I can just swap them.

    Thread Starter MDC2957

    (@mdc2957)

    Order Updated will not work as it would result it too many activations. I did some more googling and found this:

    https://gist.github.com/onetarek/6652c0ceb04c81918b78dca5e495c49a

    This could work, except I think it only goes for orders in the completed status. Problem is I might receive orders that contain both shipped and virtual products, so those will go to processing status. Obviously, the customer will have to wait for his shipped items to ship before the order can be completed, but he paid, so he should get access to the virtual product (handled by the Make automation).

    So I guess what I need is the ability to send the webhook when payment is received, whether that’s completed or processing status. But then again, I don’t want the webhook to get sent twice on the same order, i.e. once for processing and once for completed. So maybe I should just not worry about the rare case where virtual and shipped are purchased together, and handle it manually when it arises?

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