• Resolved aaraujo4

    (@aaraujo4)


    Hello, all events trigger fine but when i place a order, instead of triggering the purchase event, it triggers the begin_checkout again.

    Can you help me?

    In this image you can see the normal begin_checkout and the right url:
    https://ibb.co/yYXQKPj

    but then i place the order and begin_checkout triggers again:
    https://ibb.co/r3MhSnn

    Help me please!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    The problem is that your order-received page (/finalizar-compra/order-pay/) is not registered as the order-received page in WooCommerce.

    You must make sure that order-pay is registered as the order-received page in the Woo settings under: WooCommerce > Advanced > Page.

    This may not be enough if the problem was caused by customization or a payment plugin that does not comply with the Woo standard.

    You need to make sure that your order received page works with the WooCommerce function is_order_received_page(). If you want a customized order received page, best practise is to modify the wocommerce/checkout/thankyou.php template in you theme.

    GTM Kit fires the events as follows:

    The begin_checkout event is fired if the WooCommerce function is_checkout() === true

    The purchase event is fired if the WooCommerce function is_order_received_page() === true

    The reason why you have a begin_checkout event on your order-received page is because the is_order_received_page() check failed, and is_checkout() is true for both /checkout/order-received and /checkout. That is why the is_order_received_page() is checked first in WooCommerce.php#L327

    So, if your order received page is recognized by WooCommerce as such it will work as expected.

    If you have a customized order-received page that for some reason is not recognized by the is_order_received_page() function you can use the filter hook woocommerce_is_order_received_page and set the value to true on your order received page.

    In any case this is a WooCommerce issue and not a problem that can be solved in GTM Kit or Google Tag Manager because GTM Kit relies on is_order_received_page().

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Do you still need help or can i close this?

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Closing this as resolved

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Purchase event not triggering’ is closed to new replies.