add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 48;' ), 20 );
+// This is more for Gilmore, but testing it on Tom's Mom's
+add_filter('upload_mimes', 'custom_upload_mimes');
+function custom_upload_mimes ( $existing_mimes=array() )
+{
+ // Add *.EPS files to Media upload
+ $existing_mimes['eps'] = 'application/postscript';
+ // Add *.AI files to Media upload
+ $existing_mimes['ai'] = 'application/postscript';
+ return $existing_mimes;
+}
-
+ /**
+ * WooCommerce Checout Field Additions
+ */
+
+ // Add custom fields to checkout
+
+ add_filter( 'woocommerce_after_order_notes' , 'tm_added_checkout_fields' );
+
+ function tm_added_checkout_fields( $checkout ) {
+
+ echo '<div id="tm_gift_message"><h3>' . __('Gift Message') . '</h3>';
- 'maxlength' => 150,
++
+ woocommerce_form_field( 'tm_gift_message', array(
+ 'type' => 'textarea',
+ 'class' => array('my-field-class form-row-wide'),
+ 'label' => __(''),
+ 'placeholder' => __('Enter any desired gift message here.'),
-
++ 'maxlength' => 150,
+ ), $checkout->get_value( 'tm_gift_message' ));
-
++
+ echo '</div>';
+
+ echo '<div id="tm_fedex_shipping"><h3>' . __('FedEx Shipping') . '</h3>';
-
++
+ woocommerce_form_field( 'tm_fedex_shipping', array(
+ 'type' => 'textarea',
+ 'class' => array('my-field-class form-row-wide'),
+ 'label' => __(''),
+ 'placeholder' => __('If you wish to charge shipping to your FedEx Account, please provide account number OR contact phone number here.'),
+ ), $checkout->get_value( 'tm_fedex_shipping' ));
-
++
+ echo '</div>';
+
+ }
+
+ // Get custom field data and store it in post meta data
+
+ add_action( 'woocommerce_checkout_update_order_meta', 'tm_added_checkout_fields_order_meta' );
-// Display custom fields in admin order data
++
+ function tm_added_checkout_fields_order_meta( $order_id ) {
+
+ if ( ! empty( $_POST['tm_gift_message'] ) ) {
+ update_post_meta( $order_id, 'Gift Message', sanitize_text_field( $_POST['tm_gift_message'] ) );
+ }
+
+ if ( ! empty( $_POST['tm_fedex_shipping'] ) ) {
+ update_post_meta( $order_id, 'FedEx Shipping', sanitize_text_field( $_POST['tm_fedex_shipping'] ) );
+ }
+
+ }
+
+// Add a $1.00 handling fee to all orders.
+add_action( 'woocommerce_cart_calculate_fees','endo_handling_fee' );
+function endo_handling_fee() {
+ global $woocommerce;
-add_action( 'woocommerce_admin_order_data_after_billing_address', 'tm_added_checkout_fields_admin_order_meta', 10, 1 );
+ if ( is_admin() && ! defined( 'DOING_AJAX' ) )
+ return;
-function tm_added_checkout_fields_admin_order_meta($order){
- echo '<p><strong>'.__('Gift Message').':</strong><br> ' . get_post_meta( $order->id, 'Gift Message', true ) . '</p>';
- echo '<p><strong>'.__('FedEx Shipping').':</strong><br> ' . get_post_meta( $order->id, 'FedEx Shipping', true ) . '</p>';
+ $fee = 1.00;
+ $woocommerce->cart->add_fee( 'Handling Fee', $fee, true, 'standard' );
}
-
-
?>
+