• Skip to main content
  • Skip to primary sidebar

WordPress, Genesis Framework and Storefront customization tutorials

  • Archive
    • Free
    • Premium
  • Blog
  • About
  • Contact
  • Newsletter
  • Login
Home » WooCommerce » Page 4

WooCommerce

Add custom text below the table of email notification


add_action('woocommerce_email_after_order_table', 'add_email_shipping_text');
function add_email_shipping_text(){
echo '';
}

Filed Under: Free Tagged With: WooCommerce

Removing BACS instructions from email notifications in WooCommerce


add_action( 'woocommerce_email_before_order_table', function(){
if ( ! class_exists( 'WC_Payment_Gateways' ) ) return;

$gateways = WC_Payment_Gateways::instance(); // gateway instance
$available_gateways = $gateways->get_available_payment_gateways();

if ( isset( $available_gateways['bacs'] ) )
remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['bacs'], 'email_instructions' ), 10, 3 );
}, 1 );

Filed Under: Free Tagged With: WooCommerce

Add instructions to the email, based on the payment method

add_action( 'woocommerce_before_email_order', 'add_order_instruction_email', 10, 2 );
 
function add_order_instruction_email( $order, $sent_to_admin ) {
 
 if ( ! $sent_to_admin ) {
 
 if ( 'cod' == $order->payment_method ) {
 // cash on delivery method
 echo '<p><strong>Instructions:</strong> Full payment is due immediately upon delivery: <em>cash only, no exceptions</em>.</p>';
 } else {
 // other methods (ie credit card)
 echo '<p><strong>Instructions:</strong> Please look for "Madrigal Electromotive GmbH" on your next credit card statement.</p>';
 }
 }
}

Filed Under: Premium Tagged With: WooCommerce

How to change WooCommerce email subject


{order_date} keltezésű {site_title} rendelés visszaigazolása

Filed Under: Free Tagged With: WooCommerce

WooCommerce emails based on payment method


function add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
    $payment_method = $order->payment_method;
    if ( $payment_method == 'bacs' ) {
        echo 'Your text';
    }
}
add_action( 'woocommerce_email_before_order_table', 'add_content_specific_email', 20, 4 );

Filed Under: Free Tagged With: WooCommerce

Order date-time in customer processing order email notification


//Order date-time in customer processing order email notification
add_action( 'woocommerce_email_order_details', 'custom_processing_order_notification', 1, 4 );
function custom_processing_order_notification( $order, $sent_to_admin, $plain_text, $email ) {
// Only for processing email notifications to customer
if( ! 'customer_processing_order' == $email->id ) return;

$date_modified = $order->get_date_modified();
$date_paid = $order->get_date_paid();

$date = empty( $date_paid ) ? $date_modified : $date_paid;

echo sprintf( '<p>A rendelés száma: %s <br>A rendelés dátuma: <time>%s</time>)</p>',
$order->get_order_number( ),
$date->date("Y.m.j.")
);
}

Filed Under: Premium Tagged With: WooCommerce

Shipping method – Show only the selected description


function syslab_update_order_review_fragments( $array ) {
// make filter magic happen here...
$array['.woocommerce-checkout-review-order-table'] = $array['.woocommerce-checkout-review-order-table'].'<script>jQuery(".shipping_method:checked").parent("li").find(".shipping-desc").stop().show();</script>';
return $array;
};
// add the filter
add_filter( 'woocommerce_update_order_review_fragments', 'syslab_update_order_review_fragments', 10, 1 );

Filed Under: Free Tagged With: WooCommerce

Fix broken lightbox on product single page


add_action( 'after_setup_theme', 'yourtheme_setup' );

function yourtheme_setup() {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}

Filed Under: Free Tagged With: WooCommerce

Remove product main content editor


//REMOVE PRODUCT MAIN EDITOR - CONTENT EDITOR
function remove_product_editor() {
remove_post_type_support( 'product', 'editor' );
}
add_action( 'init', 'remove_product_editor' );

Filed Under: Free Tagged With: WooCommerce

Change number of products displayed per page


add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );

function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 60;
return $cols;
}

Filed Under: Free Tagged With: WooCommerce

WooCommerce add text to the thank you page order number

//WooCommerce add text to the thank you page order number - rendelésszám

add_action( 'woocommerce_thankyou_order_received_text', 'weitzterez_add_content_thankyou' );

function weitzterez_add_content_thankyou() {
echo '<h2 class="h2thanks">Banki átutalásnál a <strong>rendelés számot</strong> kérlek, írd bele a megjegyzés rovatba!</h2><p class="pthanks"></p>';
}

Filed Under: Free Tagged With: WooCommerce

Add support to zoom gallery


add_action( 'after_setup_theme', 'yourtheme_setup' );
 
function yourtheme_setup() {
 add_theme_support( 'wc-product-gallery-zoom' );
 add_theme_support( 'wc-product-gallery-lightbox' );
 add_theme_support( 'wc-product-gallery-slider' );
}

Filed Under: Free Tagged With: WooCommerce

Remove Zoom, Gallery on Single Product Page


add_action( 'after_setup_theme', 'bbloomer_remove_zoom_lightbox_theme_support', 99 );

function bbloomer_remove_zoom_lightbox_theme_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
remove_theme_support( 'wc-product-gallery-slider' );
}

Filed Under: Free Tagged With: WooCommerce

Change add to cart button to view product


/*STEP 1 - REMOVE ADD TO CART BUTTON ON PRODUCT ARCHIVE (SHOP) */

function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action('init','remove_loop_button');

/*STEP 2 -ADD NEW BUTTON THAT LINKS TO PRODUCT PAGE FOR EACH PRODUCT */

add_action('woocommerce_after_shop_loop_item','replace_add_to_cart');
function replace_add_to_cart() {
global $product;
$link = $product->get_permalink();
echo do_shortcode('<a href="'.$link.'" class="button addtocartbutton">Megtekintés</a>');
}

Filed Under: Free Tagged With: WooCommerce

Disable Payment Method for Specific Category


add_filter('woocommerce_available_payment_gateways','bbloomer_unset_gateway_by_category');

function bbloomer_unset_gateway_by_category($available_gateways){
global $woocommerce;
$category_IDs = array(38,39);
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
$terms = get_the_terms( $values['product_id'], 'product_cat' );
foreach ($terms as $term) {
if(in_array($term->term_id, $category_IDs)){
unset( $available_gateways['cod'] );
break;
}
break;
}
}
return $available_gateways;
}

Filed Under: Premium Tagged With: WooCommerce

Add Tabs after Add to cart button


//Add Tabs after Add to cart button
add_action( 'woocommerce_single_product_summary', 'wc_custom_show_attributes_outside_tabs', 35 );
function wc_custom_show_attributes_outside_tabs() {
global $product;
$product->list_attributes();
}

Filed Under: Free Tagged With: WooCommerce

Remove Additional informations


//Remove Additional informations
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
}

Filed Under: Free Tagged With: tab, WooCommerce

Send customer directly to the checkout


//send customer directly to the checkout
add_filter('add_to_cart_redirect', 'theme_prefix_add_to_cart_redirect');
function theme_prefix_add_to_cart_redirect() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}

Filed Under: Free Tagged With: WooCommerce

Remove quantity field


//REMOVE QUANTITY FIELD
add_filter( 'woocommerce_is_sold_individually', 'wc_remove_all_quantity_fields', 10, 2 );
function wc_remove_all_quantity_fields( $return, $product ) {
return( true );
}

Filed Under: Free Tagged With: WooCommerce

Change add to cart button text


//CHANGE ADD TO CART BUTTON TEXT
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_single_add_to_cart_text' ); // 2.1 +

function woo_custom_single_add_to_cart_text() {

return __( 'Kosárba teszem', 'woocommerce' );

}

Filed Under: Free Tagged With: WooCommerce

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Go to Next Page »

Primary Sidebar

Gabor Flamich

Hi! I'm Gabor.
I write tutorials on WordPress and WooCommerce.

MacBook

12 Essential Snippets for Genesis Developers

Subscribe to my Newsletter to view my basic collection of Genesis snippets that I use for my projects!

Sign Up for Free
  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube
UpdraftPlus Premium

Tags

ACF Ajax Analytics API Bootstrap Breadcrumb category CPT CSS fetch FSE Genesis Google Maps Gutenberg HTML Isotope JavaScript jQuery loop Map Menu Parallax PHP Rest API SASS SEO SQL Storefront SVG tab tag manager tags Taxonomy Tool upsell Webpack Wholesale WooCommerce WordPress WPML

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy / Terms of Service
© 2025 WP Flames - All Right Reserved