Skip to content

Instantly share code, notes, and snippets.

@dossy
dossy / snippet.html
Last active October 29, 2022 14:01
Disable submit buttons on Gravity Forms when required fields are empty
<script type="text/javascript">
// don't forget to add a style for:
// `input[type="submit"].disabled, input[type="submit"].button-disabled, input[type="submit"]:disabled`
jQuery(function ($) {
$('form[id^="gform_"]').on('change', function (e) {
var $reqd = $(this).find('.gfield_contains_required.gfield_visibility_visible').filter(function (i, c) {
return []
.concat($(c).find('input[type="text"], textarea').filter(function (i, fl) { return $(fl).val().length == 0; }).get())
.concat($(c).find('input[type="checkbox"]').not(':checked').get())
.length;
@lucasstark
lucasstark / gist:6594983
Created September 17, 2013 14:21
Example to add meta data to woocommerce cart items
<?php
/*
* Plugin Name: Example Modify Price
*/
class Example_Modify_Price {
private static $instance;
public static function register() {
if (self::$instance == null) {