Skip to content

Instantly share code, notes, and snippets.

@drabbytux
drabbytux / get-customization-information-for-products.js
Last active June 22, 2017 00:25 — forked from carolineschnapp/gist:11167400
Get custom information for product javascript for theme.js
jQuery(function($) {
$('form[action="/cart/add"]').submit(function() {
var formIsValid = true;
var message = "Please fill this out and you will be able to add the item to your cart.";
$(this).find('[name^="properties"]').filter('.required, [required="required"]').each(function() {
$(this).removeClass('error');
if (formIsValid && $(this).val() == '') {
formIsValid = false;
message = $(this).attr('data-error') || message;
$(this).addClass('error');