Home › Forums › WoodMart support forum › Order attribution fields render outside checkout form (Layout Builder)

Order attribution fields render outside checkout form (Layout Builder)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #730642

    ballindigital
    Participant

    Hi,

    On our WoodMart site, the WooCommerce Order Attribution element is rendered outside the checkout form. Because of that, the attribution fields are never submitted and every checkout order is saved with Origin “Unknown”.

    Setup
    – WoodMart [VERSION], checkout built with Layout Builder (custom Checkout layout), [PAGE BUILDER]
    – WooCommerce 11.1.2 with Order Attribution enabled
    – WPML active, tested on the English checkout at /en/checkout/
    – Guest checkout disabled, Stripe gateway

    What we see
    WooCommerce outputs one wc-order-attribution-inputs element on the checkout page. It is present, but it is not inside form.checkout.

    Console results on /en/checkout/ (logged in, items in cart):

    document.querySelectorAll(‘wc-order-attribution-inputs’).length
    Result: 1

    !!document.querySelector(‘form.checkout wc-order-attribution-inputs’)
    Result: false

    new FormData(document.querySelector(‘form.checkout’)).get(‘wc_order_attribution_source_type’)
    Result: null

    Already ruled out
    – Consent: wc_order_attribution.params.allowTracking is true and the WP Consent API is not active
    – Feature setting: Order Attribution is enabled
    – Payment method: affected orders are standard card payments

    Questions
    1. As far as we understand, WooCommerce adds this element once, on the first of its standard checkout hooks to fire (for example woocommerce_after_checkout_billing_form or woocommerce_checkout_after_customer_details). Is one of these hooks fired outside the form tag in the Layout Builder checkout?
    2. Is this a known issue, and is there a fix or a recommended way to make sure the element is rendered inside the checkout form?
    3. If it comes from how our Checkout layout is built, which element should we change?

    Thanks

    #730668

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    We have tested the checkout on your website and were unable to reproduce the reported issue. The WooCommerce Order Attribution fields are currently being rendered within the checkout form and are submitted correctly when placing an order.

    For your clarification, I have placed an order on your site and have not seen the issue.

    Best Regards

    #730670

    ballindigital
    Participant

    Hi Aizaz,

    Thanks for testing. The order you placed actually reproduces the issue.

    Your test order is #2657 (placed 7 October, English checkout, cash on delivery). In WooCommerce > Orders, its Origin column shows “Unknown”, and the Order attribution box on the order edit screen also shows Origin: Unknown. If the attribution fields had been submitted with the checkout form, WooCommerce would have saved a value such as Direct, Organic or Referral. So the order went through, but the attribution data did not.

    This matches the console results in my first post, where the wc-order-attribution-inputs element exists on the checkout page but is not inside form.checkout, and the form data returns null for wc_order_attribution_source_type.

    To rule out consent: your test order had analytics and marketing consent denied, but order #2646 had full consent granted and also saved as Unknown. WooCommerce Order Attribution is not consent gated on this site (allowTracking is true and the WP Consent API is not active).

    Could you please:

    1. Open order #2657 and confirm you see Origin: Unknown.
    2. Tell me how you verified that the fields are inside the form and submitted. A screenshot of the Elements panel showing wc-order-attribution-inputs inside form.checkout, and of the checkout request payload containing wc_order_attribution_source_type, would settle it.
    3. Let me know if you changed any settings on the site during testing.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #730680

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please check how it works with the default WordPress theme and Woocommerce Storefront theme just to check whether the issue is with our theme or not. Also, please check the site with our theme but only with the theme default plugins activate, and deactivate all the 3rd party plugins from the site.

    If it works fine with the default WordPress theme then let me know i will further check on your site and give you a possible solution.

    Best Regards

    #730715

    ballindigital
    Participant

    Hi,

    Thanks for looking into this. One correction first: your test order #2657 saved as Origin “Unknown”, so it actually reproduced the issue.

    We’ve now confirmed the cause on a staging copy of the site:

    – Order #2660, no changes: Origin Unknown
    – Order #2662, with a small script that moves the wc-order-attribution-inputs element inside form.checkout: Origin Direct

    That script was the only change between the two orders. The attribution element is being rendered outside the checkout form by the Layout Builder checkout, so the fields are never submitted with the order. WooCommerce outputs this element on the woocommerce_after_order_notes hook, so that hook is the likely place to look.

    Staging access:
    https://www.staging2.rawpetfood.es/wp-admin/
    Your existing login works there as it’s a copy of the live site.

    The script is deactivated on staging so you can reproduce the issue. Cash on delivery is enabled for test orders. Please do not pay by card, as the Stripe keys are live. You’re welcome to switch theme and deactivate plugins on staging.

    We’re running the workaround on the live site for now. Could you confirm this is a Layout Builder bug and whether a fix is planned?

    Thanks,
    Harv

    #730745

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please check your staging site again and review the new order that has been created. The order attribute is showing on the site now.

    Please confirm whether the issue is still occurring and let me know.

    Best Regards

    #730762

    ballindigital
    Participant

    This was not helpful at all. You have not been helpful. You just turned off every fucking plugin, including WoodMart ones and even Stripe and told me to test? Seriously, WTF. If you don’t like your job, get a new one.

    #730764

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    I understand your frustration, and I apologize for the confusion.

    I have just checked the staging site. For troubleshooting, I have temporarily deactivated the third-party plugins, while keeping WoodMart Core and WooCommerce active. With this setup, the Order Attribution fields are now being rendered correctly, and the Origin information is appearing in the order.

    Please test the checkout on the staging site now and confirm whether the attribution is saved correctly.

    If the issue is resolved with this configuration, we can then reactivate the plugins one by one and test after each activation. This will allow us to identify which plugin or integration is causing the Order Attribution element to be rendered outside the checkout form.

    Once we identify the conflicting plugin, we can investigate further and determine the appropriate solution.

    Best Regards,

Viewing 8 posts - 1 through 8 (of 8 total)