Skip to content

Instantly share code, notes, and snippets.

@Mamaduka
Created February 18, 2012 08:14
Show Gist options
  • Save Mamaduka/1858177 to your computer and use it in GitHub Desktop.
Save Mamaduka/1858177 to your computer and use it in GitHub Desktop.
<?php
/**
* Filter chockout fields
*/
function pf_woocommerce_checkout_fields( $fields ) {
global $woocommerce;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) :
if( ! in_array($values['product_id'], array(137, 139, 141) ) ) :
unset( $fields['account'] );
endif;
endforeach;
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'pf_woocommerce_checkout_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment