Home / Validation System
Duplicate Snippet

Embed Snippet on Your Site

Validation System

To make a field required all you have to do is set the HTML 5 required attribute on the field and it will become required. The following example shows how to make the SKU field required.

Code Preview
php
<?php
// Add this to your themes functions.php 
add_filter( 'wcv_product_sku', 'wcv_product_sku' );
function wcv_product_sku( $field ){
	$field[ 'custom_attributes' ] = array( 'required' => "", 'data-parsley-error-message' => 'SKU is required' );
	return $field;
}

Comments

Add a Comment