christianslater
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] custom payment info text in email based on product?Thanks! I changed this with your code but this does not work. Is there any mistake in my code?
`// Description: Add different Email payment instructions based on order
add_action( ‘woocommerce_email_before_order_table’, ‘add_order_email_instructions’, 10, 2 );
function add_order_email_instructions( $order, $sent_to_admin ) {
if ( $order->has_status( ‘processing’ ) ) {
foreach($order->get_items() as $item) {
$_product = get_product($item[‘product_id’]);
if ($item[‘product_id’]==157) {
echo ‘<p>Text A</p>’;
}
elseecho ‘<p>Text B</p>’;
}
}
}Forum: Plugins
In reply to: [WooCommerce] custom payment info text in email based on product?OK I see. Unfortunately I am totally noob in coding. Can you point me in the right direction?
I guess I have to ask If the order status is customer processing order, right?
Forum: Plugins
In reply to: [WooCommerce] custom payment info text in email based on product?Thanks for Your reply!
I have not thought about this solution. Unfortunately I have to edit very many products this way but only to type of notes. Gift Card or Event.
I have added this code to my functions.php this is working good. Only Problem is, that I want this text only to appear in customer processing order and not in all client emails. Is there a way to restrict this code to only the customer processing order?
Here’s what I’ve got so far:
// Description: Add different Email payment instructions based on order add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 ); function add_order_email_instructions( $order, $sent_to_admin ) { if ( ! $sent_to_admin ) { foreach($order->get_items() as $item) { $_product = get_product($item['product_id']); if ($item['product_id']==157) { echo '<p>Text A</p>'; } else echo '<p>Text B</p>'; } } }
Forum: Plugins
In reply to: [WooCommerce] Change quantity input is overriding number of items in cart!?Thanks that did the trick!
Forum: Plugins
In reply to: [Events Manager - Calendar, Bookings, Tickets, and more!] booking?I already took a look. But I think it’s no practicable to use this for booking lets say a room. I have to create for every 15 minute intervall a recurrring event for several years….
Forum: Plugins
In reply to: [HTML5 Responsive FAQ] accordion?same to me!
Forum: Plugins
In reply to: [HTML5 Responsive FAQ] accordion?so is accordion now included. sorry cant see it in changelog thats why i am asking.
Forum: Plugins
In reply to: [WooCommerce] only show custom tabs if not empty?wow that’s great! It#s working perfectly. Thanks again for Your time!!
Forum: Plugins
In reply to: [WooCommerce] only show custom tabs if not empty?mhm sorry I don’t understand. I want to show “einbau_video_2” in the same tab just below “einbau_video”. Where do I have to put this code?
Sorry for my dumb question…
Forum: Plugins
In reply to: [WooCommerce] only show custom tabs if not empty?Thanks again,
I think thats the right way.
How can I add “show_video_2” to the callback
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_2' ); function woo_new_product_tab_2( $tabs ) { $var = get_field( 'einbau_video' ); if( !empty($var) ){ $tabs['video'] = array( 'title' => __( 'Video', 'woocommerce' ), 'priority' => 20, 'callback' => 'show_video' ); } return $tabs; }
that’s what I got so far:
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_2' ); function woo_new_product_tab_2( $tabs ) { $var = get_field( 'einbau_video' ); if( !empty($var) ){ $tabs['video'] = array( 'title' => __( 'Video', 'woocommerce' ), 'priority' => 20, 'callback' => 'show_video' ); } return $tabs; } function show_video() { echo '<div class="video-container">'; echo get_field( 'einbau_video' ); echo '</div>'; } function show_video_2() { $field = get_field( 'einbau_video_2' ); if (!empty($field)) { echo '<div class="video-container">'; echo $field; echo '</div>'; } }
Forum: Plugins
In reply to: [WooCommerce] only show custom tabs if not empty?Hi lorro,
thanks again for your help. It works perfectly. I have another question. I want to add another custom field in the same tab. So If I input another Video it shows under the first one.How can I add the custom field “einbau_video_2” to that code?
If I just add the custom field to the echo section is is showing, even if there’s no video
function show_video() { echo '<div class="video-container">'; echo get_field( 'einbau_video' ); echo '</div>'; echo '<div class="video-container">'; echo get_field( 'einbau_video_2' ); echo '</div>';}
This is my actual code.
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_2' ); function woo_new_product_tab_2( $tabs ) { $var = get_field( 'einbau_video' ); if( !empty($var) ){ $tabs['video'] = array( 'title' => __( 'Video', 'woocommerce' ), 'priority' => 20, 'callback' => 'show_video' ); } return $tabs; } function show_video() { echo '<div class="video-container">'; echo get_field( 'einbau_video' ); echo '</div>'; }
Any help is appreciated.
Forum: Plugins
In reply to: [HTML5 Responsive FAQ] accordion?cool! When is it coming?
Forum: Plugins
In reply to: [WooCommerce] only show custom tabs if not empty?thanks. works perfectly!
Forum: Plugins
In reply to: [WooCommerce] only show custom tabs if not empty?OK, as I am no PHP expert. Is there any other solution?
Thanks for Your reply. This is cool! Is it possible to get a blind copy of the email address sender as admin?