Skip to content

Instantly share code, notes, and snippets.

@rajakannan
rajakannan / gv-copy-.js
Created Jan 7, 2016
Gravity Form copy form fields (Eg: same as billing address check box for shipping address )
View gv-copy-.js
function bindGformHandlers() {
//bind the click function
$(document).on('click', '.fill-check input', function() {
if($(this).is(':checked')) {
//put in the selectors we fill from
var fill_from = $('.fill-from, .fill-from .name_last, .fill-from .name_first');
fill_from.each(function() {
//get the label
@rajakannan
rajakannan / gformscopyaddress.js
Created Jan 7, 2016 — forked from tnorthcutt/gformscopyaddress.js
Autofill a set of fields (in a gravity form, in this case) based on a checkbox being checked.
View gformscopyaddress.js
jQuery(document).ready(function($) {
$('input#choice_13_1').click(function() {
if($(this).is(':checked')) {
$('#input_2_12_1').val($('#input_2_2_1').val());
$('#input_2_12_2').val($('#input_2_2_2').val());
$('#input_2_12_3').val($('#input_2_2_3').val());
$('#input_2_12_4').val($('#input_2_2_4').val());
$('#input_2_12_5').val($('#input_2_2_5').val());
};
});
@rajakannan
rajakannan / wc-product-meta-display.php
Created Mar 1, 2015
Here is a quick snippet to display WooCommerce product custom meta fields values (place it in functions.php):
View wc-product-meta-display.php
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Display product meta field in a shortcode
* ex: [woo_custom_field id="my-custom-field"]
*
*/
function woo_custom_field_shortcode( $atts, $content = null ) {
View Woocommerce-product-meta.php
<?php
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
function woo_add_custom_general_fields() {
@rajakannan
rajakannan / Disable_PayPal_payment_method_in_the_checkout.php
Last active Nov 15, 2019
Disable PayPal payment method in the checkout
View Disable_PayPal_payment_method_in_the_checkout.php
<?php
/*
* Disable PayPal payment method in the checkout if certain
* products are present in the cart.
*
* Add this to your theme's functions.php file
*/
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways( $gateways ){
@rajakannan
rajakannan / woocommerce.php
Last active Nov 15, 2019
Collection of essential snippets
View woocommerce.php
<?php
/**
* Display field value on the admin order edit page
*/
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('My Field').':</strong> ' . get_post_meta( $order->id, 'My Field', true ) . '</p>';
}
View shipping-awd.php
<?php
/**
* Plugin Name: AWD Weight/State Shipping
* Plugin URI: http://www.andyswebdesign.ie/blog/free-woocommerce-weight-and-country-based-shipping-extension-plugin/
* Description: Weight and State based shipping method for Woocommerce.
* Version: 1.0.1
* Author: Andy_P (modified by Mantish to make it state based)
*/
/** Copyright 2012 andyswebdesign.ie
@rajakannan
rajakannan / Streetview_with_road_map_binded.html
Last active Aug 29, 2015
Displaying a road map on top of the street view and binding them
View Streetview_with_road_map_binded.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example: Street View with Map</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/standard.css" rel="stylesheet" type="text/css" />
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
@rajakannan
rajakannan / 0_reuse_code.js
Created Jun 6, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.