Defer WooCommerce Transactional Emails

/** * This will turn on deferred transactional emails in WooCommerce. This may help if you * are experiencing slow checkouts or checkout timeouts. */ add_filter( ‘woocommerce_defer_transactional_emails’, ‘__return_true’ );Continue reading

Load Dashicons for Logged In Only

function disable_dashicons_frontend() { if ( ! is_user_logged_in() ) { wp_dequeue_style( ‘dashicons’ ); wp_deregister_style( ‘dashicons’ ); } } add_action( ‘wp_enqueue_scripts’, ‘disable_dashicons_frontend’ );Continue reading

Add shipping short description

function ts_add_description_field_to_shipping_method( $fields ) { $fields[‘short_description’] = array( ‘title’ => __( ‘Short Description’, ‘woocommerce’ ), ‘type’ => ‘textarea’, ‘description’ => __( ‘Add a short description for this shipping method.’, ‘woocommerce’ ), ‘default’ => ”, ‘desc_tip’ => true, ); return $fields;…Continue reading

Remove Astra Header

add_action( ‘wp’, ‘remove_astra_header_callback’); function remove_astra_header_callback(){ remove_action( ‘astra_header’, ‘astra_header_markup’ ); } add_action(‘wp’, ‘ast_remove_footer’); function ast_remove_footer() { remove_action(‘astra_footer’, array(Astra_Builder_Footer::get_instance(), ‘footer_markup’)); }Continue reading

Shipping with priority processing

add_action(‘woocommerce_checkout_create_order’, ‘add_priority_processing_to_shipping_method’, 10, 1); function add_priority_processing_to_shipping_method($order) { $has_priority_fee = false; foreach ($order->get_items(‘fee’) as $fee) { if (stripos($fee->get_name(), ‘Priority Processing’) !== false) { $has_priority_fee = true; break; } } if ($has_priority_fee) { foreach ($order->get_shipping_methods() as $shipping_method) { $shipping_method_name = $shipping_method->get_name(); if…Continue reading

COAs img

/************************************************/ /* Show image of individual product */ /************************************************/ /* function show_img_producto() { global $post; // Obtener los COAs relacionados con el producto actual $related_coas = get_posts(array( ‘post_type’ => ‘coa’, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘parent_product’,…Continue reading

Default Postal Code

add_action(‘woocommerce_checkout_create_order’, function ($order, $data) { $default_postcode = ‘00000’; if (empty($order->get_billing_postcode())) { $order->set_billing_postcode($default_postcode); } }, 10, 2);Continue reading