Undefined constant “gtm4wp_compile_datalayer”
-
Hi, I’m trying to add custom values to datalayer, I’m using your filter example found here: https://gtm4wp.com/gtm4wp-for-developers/actions-and-filters-in-gtm4wp-for-developers
This is my code
if ( function_exists( 'WC' ) ) { add_filter( 'gtm4wp_compile_datalayer', 'my_filter', 20 ); function my_filter( array $dataLayer ): array { $order_id = $_POST['order_id']; $order = wc_get_order($order_id); $vat_numnber = $order->get_meta('billing_invoice_type'); $dataLayer["companyPrivate"] = $vat_numnber; return $dataLayer; } }
This code return the error ‘Undefined constant “gtm4wp_compile_datalayer”‘, what am I doing wrong?
Thanks
- The topic ‘Undefined constant “gtm4wp_compile_datalayer”’ is closed to new replies.