Skip to content

Instantly share code, notes, and snippets.

@woogist
woogist / gist:5541418
Created May 8, 2013 15:54
WooCommerce - Change Placeholder Image
/*
* goes in theme functions.php or a custom plugin. Replace the image filename/path with your own :)
*
**/
add_action( 'init', 'custom_fix_thumbnail' );
function custom_fix_thumbnail() {
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
@michaeltieso
michaeltieso / gist:0068bf05f4ad64577e54
Created September 22, 2014 20:17
Dynamic Pricing + Product Add-ons
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $cart_object ) {
foreach ( $cart_object->cart_contents as $key => $value ) {
$addons = $value['addons'];
$add_to_price = 0;
foreach($addons as $addon) {
$add_to_price .= $addon['price'];