jselin21
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Order attribution origin unknownHi @linusl, I’ve been following your quest for this problem because I have the same irritating problem. After A LOT of debugging I manage to narrow it down to being a Klarna Checkout problem for me, because the attribution-fields works just fine when I use a different payment method.
I’m currently using WooCommerce 8.8.3 and you can browse the file i found containing the webhook here: https://plugins.trac.ww.wp.xz.cn/browser/woocommerce/tags/8.8.3/src/Internal/Orders/OrderAttributionController.php
The webhook that order-attribution uses (woocommerce_checkout_after_customer_details) is not a part of the klarna-checkout.php that overrides WooCommerce default form-checkout.php.
114 add_action( 'woocommerce_checkout_after_customer_details', array( $this, 'stamp_html_element' ) ); 115 add_action( 'woocommerce_register_form', array( $this, 'stamp_html_element' ) );So I tested a few other webhooks at first but they didn’t work, so i browsed through the Klarna checkout plugin files and found that they use “klarna-checkout-for-woocommerce/templates/klarna-checkout.php” for the checkout and they call on the webhook woocommerce_before_checkout_form.
<?php /** * Klarna Checkout page * * Overrides /checkout/form-checkout.php. * * @package klarna-checkout-for-woocommerce */ do_action( 'woocommerce_before_checkout_form', WC()->checkout() ); ....So i knew that webhook would work and I tested it by just adding another add_action right under the other ones and now I have order-attribution working again.
114 add_action( 'woocommerce_checkout_after_customer_details', array( $this, 'stamp_html_element' ) ); 115 add_action( 'woocommerce_register_form', array( $this, 'stamp_html_element' ) ); // added this line add_action( 'woocommerce_before_checkout_form', array( $this, 'stamp_html_element' ) );But this is straight in the core-file and I bet there’s a better way for implementing this, I’m just an
autodidact amateur that have created my ecommerce-business with a lot of reading, watching youtube and good old trial & error, but I’m really good at details and problem-solving and yeah I’m a fast learner 🙂 I’m guessing that you’re also Swedish so there’s a big chance that you also use Klarna Checkout, even if you don’t I think you can implement a similar solution to the checkout you use, btw there’s also a lot of themes that have custom checkout templates. I feel your frustration so I really hope this can help solving your problem.Best regards,
Johan