Skip to content

Instantly share code, notes, and snippets.

@nickburne
nickburne / Customise ‘add to cart’ text on single product pages in WooCommerce
Created April 30, 2014 14:35
Customise ‘add to cart’ text on single product pages in WooCommerce
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
@nickburne
nickburne / Add a background image to the shop page only in WooCommerce
Created April 30, 2014 14:51
Add a background image to the shop page only in WooCommerce
add_filter( 'wp_head', 'wo_custom_shop_background' );
function wo_custom_shop_background() {
if( is_shop() && !is_admin() ) {
?>
<style>
body {
background: url(http://blogs.smithsonianmag.com/smartnews/files/2013/08/06177001.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
@nickburne
nickburne / Delete the sidebar in WooCommerce
Created April 30, 2014 14:56
Delete the sidebar in WooCommerce
<?php get_header(); ?>
<div id="container">
<div id="content-wrap">
<?php woocommerce_content(); ?>
</div>
</div>
<?php get_footer(); ?>
@nickburne
nickburne / gist:192609fedc540654fd9b
Last active September 16, 2015 23:25
Replace add to cart button with button to product page - WooCommerce
/*PUT THIS IN YOUR CHILD THEME FUNCTIONS FILE*/
/*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');
<p style="text-align: center;">text</p>