aahmark
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [WooCommerce] Most basic customisation seems impossibleI tried to edit a woocommerce add_action, but it does not work. Dont know whether this is the right way to customize a woocommerce action?
What I did:
added following code into woocommerce functions.php
global $woocommerce; $arr=$woocommerce->payment_gateways->get_available_payment_gateways(); remove_action( 'woocommerce_email_before_order_table', array($arr['bacs'] , 'email_instructions' ), 10, 2 ); add_action( 'woocommerce_email_before_order_table', array( $arr['bacs'], 'newemail' ), 10, 2 ); function newemail( $order, $sent_to_admin ) { if ( $sent_to_admin ) return; if ( $order->status !== 'on-hold') return; if ( $order->payment_method !== 'bacs') return; if ( $description = $arr['bacs']->get_description() ) echo wpautop( wptexturize( $description ) ); ?><h2><?php _e( 'FuckingDetails', 'woocommerce' ) ?></h2><ul class="order_details bacs_details"><?php $fields = apply_filters('woocommerce_bacs_fields', array( 'account_name' => __( 'Account Name', 'woocommerce' ), 'account_number'=> __( 'Account Number', 'woocommerce' ), 'sort_code' => __( 'Sort Code', 'woocommerce' ), 'bank_name' => __( 'Bank Name', 'woocommerce' ), 'iban' => __( 'IBAN', 'woocommerce' ), 'bic' => __( 'BIC', 'woocommerce' ) )); foreach ($fields as $key=>$value) : if(!empty($arr['bacs']->$key)) : echo '<li class="'.$key.'">'.$value.': <strong>'.wptexturize($arr['bacs']->$key).'</strong>'; endif; endforeach; ?><?php }
[Please use the code buttons when posting code ]Action removes, but then When I add my new customized action it does not trigger. Also it has problems with other payment gateways
Viewing 1 replies (of 1 total)