Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- WCVendors_Pro_Form_Helper::select( array(
- 'post_id' => $object_id,
- 'class' => 'select2',
- 'id' => 'wcv_custom_product_ingredients',
- 'label' => __( 'What time?', 'wcvendors-pro' ),
- 'placeholder' => __( 'Pick a time', 'wcvendors-pro' ),
- 'wrapper_start' => '<div class="all-100">',
- 'wrapper_end' => '</div>',
- 'desc_tip' => 'true',
- 'description' => __( 'Pick a time', 'wcvendors-pro' ),
- 'options' => array( '12:00 midnight' => __('12:00 midnight', 'wcv_custom_product_ingredients'), '12:15 midnight'=> __('12:15 midnight', 'wcv_custom_product_ingredients') )
- ) );
- ?>
- add_action('woocommerce_email_after_order_table', 'wcv_ingredients_email');
- function wcv_ingredients_email() {
- $output = get_post_meta( get_the_ID(), 'wcv_custom_product_ingredients', true );
- echo 'What time? ' . $output . '<br>';
- }
- // Tested on WooCommerce version 2.6.x and 3+ — For simple products only.
- add_action('woocommerce_email_after_order_table', 'wcv_ingredients_email', 10, 4);
- function wcv_ingredients_email( $order, $sent_to_admin, $plain_text, $email ){
- foreach($order->get_items() as $item_values){
- // Get the product ID for simple products (not variable ones)
- $product_id = $item_values['product_id'];
- $output = get_post_meta( $product_id, 'wcv_custom_product_ingredients', true );
- echo 'What time? ' . $output . '<br>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement