Snippet not executing
-
Hi, i’m having an issue where some php snippets are not working once i move them from functions.php to a snippet. Location is set to run everywhere (this is another problem that location not always works)
Example snippet (a stripped down version):
add_action( 'wc_before_payment_method_label' , 'add_payment_gateway_fee_label', 10, 1 ); function add_payment_gateway_fee_label( $id ) { if( $id == "paypal" ){ echo '<span class="custom-gateway-label paypal">' . $id . '</span>'; } elseif( $id == "cod" ){ echo '<span class="custom-gateway-label cod">' . $id . '</span>'; } elseif( $id == "bacs" ){ echo '<span class="custom-gateway-label bacs">' . $id . '</span>'; } else { echo '<span class="custom-gateway-label free">' . "free" . '</span>'; } }
Am I missing something? How can I run these snippets?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Snippet not executing’ is closed to new replies.