Fatal error Undefined constant
-
Hi,
I’m using this code:
/** * Show payment buttons in cart for specific categories ID only **/ add_filter( 'wc_braintree_cart_payment_gateways', function ( $gateways ) { $categories = [Reload,Recharges,Wiederaufladung,eSIM]; // Loop through cart items foreach ( WC()->cart->get_cart() as $cart_item ) { // Check for product categories if ( ! has_term($categories, 'product_cat', $cart_item['product_id'] ) ) { $gateways = []; break; } } return $gateways; } );
And I get:
Fatal error: Uncaught Error: Undefined constant “Reload” in /wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()’d code:7 Stack trace: #0
It works fine if I use the code directly in functions.php
Thank you for your help,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Fatal error Undefined constant’ is closed to new replies.