Lucian DEV

Starting snippets for WooCommerce custom theme

Here is a list of snippets that I use when starting a new WooCommerce website; all these snippets must be pasted in the functions.php file within your theme folder:

Add Theme Support for WooCommerce

add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
    add_theme_support( 'woocommerce' );
}

Remove default WooCommerce stylesheets

add_filter( 'woocommerce_enqueue_styles', 'yabu_dequeue_styles' );
function yabu_dequeue_styles( $enqueue_styles ) {
    unset( $enqueue_styles['woocommerce-general'] );	 // Remove the gloss
    unset( $enqueue_styles['woocommerce-layout'] );      // Remove the layout
    unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
    return $enqueue_styles;
}

Remove default WooCommerce wrapper

I usually want to remove the default wrapping container and replace it with a more appropriate tag that matches the rest of my site.

remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

add_action('woocommerce_before_main_content', 'yabu_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'yabu_theme_wrapper_end', 10);

function yabu_theme_wrapper_start() {
    echo '<div class="woo-container">';
}

function yabu_theme_wrapper_end() {
    echo '</div> ';
}

Change “Add to cart” button text

add_filter('woocommerce_product_single_add_to_cart_text', 'yabu_custom_cart_button_text');
function yabu_custom_cart_button_text() {
    return __('My button text', 'woocommerce');
}

Remove product tabs

Usually, I don’t need product tabs.

add_filter( 'woocommerce_product_tabs', 'yabu_remove_product_tabs', 98 );
function yabu_remove_product_tabs( $tabs ) {

    unset( $tabs['description'] );      	// Remove the description tab
    unset( $tabs['reviews'] ); 			// Remove the reviews tab
    unset( $tabs['additional_information'] );  	// Remove the additional information tab
    return $tabs;

}

Clients say...

I am proud of my online store made with love and professionalism by Lucian. I highly recommend!
Daniela Dinu
- https://cakevan.ro
Lucian is the man you need when you start a business and you need a website, not only is he creative, but he is also a good strategist.
Alexandru Burtan
- https://alexandru-burtan.ro
Disciplined, hardworking and inventive. That's why we collaborate to develop and manage various projects, from different fields of activity.
Razvan Ionut
- https://connecto.ro
In a world where time is the most precious resource, Lucian's speed of reaction was what pleasantly surprised me. So my site was online faster than I expected. Very well indexed by search engines although my content is 95% video. Thank you!
Ciobanu Claudiu
- https://ciobanumediafilm.ro
I sent Lucian all the information about our identity and what the site has to do, after which he started working. Absolutely from the first he presented us with the winning version. Moreover, he made things happen so fast that it was a little challenging to keep up with him :))
Cristian Zavate
- https://hebeltech.ro