Skip to content

Instantly share code, notes, and snippets.

View mattpramschufer's full-sized avatar

Matt Pramschufer mattpramschufer

View GitHub Profile
@mattpramschufer
mattpramschufer / gist:957039753ea7a0bc3344e2f817304156
Created December 11, 2017 18:21 — forked from corsonr/gist:7215762
WooCommerce: Hide Checkout Fields For Virtual Products
<?php
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' );
/**
* Remove unwanted checkout fields
*
* @return $fields array
*/
function woo_remove_billing_checkout_fields( $fields ) {
@mattpramschufer
mattpramschufer / populate_gravity_forms_pre_submission.php
Created June 5, 2019 18:31 — forked from BronsonQuick/populate_gravity_forms_pre_submission.php
Populate a hidden field in Gravity Forms before submission
<?php
/* gform_pre_submission will do all forms. gform_pre_submission_1 will do a form with an ID of 1
* Keep an eye on the priority of the filter. In this case I used 9 because the Salesforce plugin we used ran a presubmission filter at 10 so we needed this to happen before it
*/
add_filter( "gform_pre_submission_1", "add_salesforce_campaign_id_footer", 9 );
function add_salesforce_campaign_id_footer( $form ){
foreach($form["fields"] as &$field)
if($field["id"] == 2){
/* Set the variable you want here - in some cases you might need a switch based on the page ID.
* $page_id = get_the_ID();