Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Validate our custom text input field value
*/
function plugin_republic_add_to_cart_validation( $passed, $product_id, $quantity, $variation_id=null ) {
if( empty( $_POST['pr-field'] ) ) {
$passed = false;
wc_add_notice( __( 'Your name is a required field.', 'plugin-republic' ), 'error' );
}
return $passed;
}
add_filter( 'woocommerce_add_to_cart_validation', 'plugin_republic_add_to_cart_validation', 10, 4 );
@plugin-republic

This comment has been minimized.

Copy link
Owner Author

plugin-republic commented Jul 31, 2019

Hi - the full article is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.