Created
February 5, 2019 16:28
-
-
Save gareth-gillman/0cffe27dc43ab43001b31e391ff14530 to your computer and use it in GitHub Desktop.
Woo Checkout Spam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wcs_checkout_field( $checkout ) { | |
woocommerce_form_field( | |
'wcs_buyer_gift', | |
array( | |
'type' => 'text', | |
'class' => array('wcs-field form-row-wide'), | |
), | |
$checkout->get_value( 'wcs_buyer_gift' ) | |
); | |
} | |
add_action( 'woocommerce_after_order_notes', 'wcs_checkout_field' ); | |
function wcs_checkout_field_process() { | |
if ( !empty( $_POST['wcs_buyer_gift'] ) ) { | |
wc_add_notice( __( 'Unable to submit order, please contact our support.' ), 'error' ); | |
} | |
} | |
add_action('woocommerce_checkout_process', 'wcs_checkout_field_process'); | |
function wcs_header_css() { | |
echo '<style>.wcs-field {display:none;}</style>'; | |
} | |
add_filter('wp_head', 'wcs_header_css', 9999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment