Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2. WCVendors_Pro_Form_Helper::select( array(
  3. 'post_id' => $object_id,
  4. 'class' => 'select2',
  5. 'id' => 'wcv_custom_product_ingredients',
  6. 'label' => __( 'What time?', 'wcvendors-pro' ),
  7. 'placeholder' => __( 'Pick a time', 'wcvendors-pro' ),
  8. 'wrapper_start' => '<div class="all-100">',
  9. 'wrapper_end' => '</div>',
  10. 'desc_tip' => 'true',
  11. 'description' => __( 'Pick a time', 'wcvendors-pro' ),
  12. 'options' => array( '12:00 midnight' => __('12:00 midnight', 'wcv_custom_product_ingredients'), '12:15 midnight'=> __('12:15 midnight', 'wcv_custom_product_ingredients') )
  13. ) );
  14. ?>
  15.  
  16. add_action('woocommerce_email_after_order_table', 'wcv_ingredients_email');
  17. function wcv_ingredients_email() {
  18. $output = get_post_meta( get_the_ID(), 'wcv_custom_product_ingredients', true );
  19. echo 'What time? ' . $output . '<br>';
  20. }
  21.  
  22. // Tested on WooCommerce version 2.6.x and 3+ — For simple products only.
  23. add_action('woocommerce_email_after_order_table', 'wcv_ingredients_email', 10, 4);
  24. function wcv_ingredients_email( $order, $sent_to_admin, $plain_text, $email ){
  25. foreach($order->get_items() as $item_values){
  26. // Get the product ID for simple products (not variable ones)
  27. $product_id = $item_values['product_id'];
  28. $output = get_post_meta( $product_id, 'wcv_custom_product_ingredients', true );
  29. echo 'What time? ' . $output . '<br>';
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement