Skip to content

Instantly share code, notes, and snippets.

View tharmann's full-sized avatar

Tate Harmann tharmann

View GitHub Profile
@tharmann
tharmann / functions.php
Created April 6, 2016 17:27
Add a more descriptive tooltip to the CVC field on the WooCommerce order form credit card fields
<?php
//add tooltip to cvc field
function custom_credit_card_fields_cis_cc ($cc_fields , $payment_id){
$cc_fields['card-cvc-field'] = str_replace('<p class="form-row form-row-last">','<p class="form-row form-row-last" title="3-digit security code usually found on the back of your card. American Express cards have a 4-digit code located on the front.">',$cc_fields['card-cvc-field']);
return $cc_fields;
}
add_filter( 'woocommerce_credit_card_form_fields' , 'custom_credit_card_fields_cis_cc' , 10, 2 );
@tharmann
tharmann / functions.php
Last active April 27, 2016 18:31
Append count in parentheses to each menu item on menu of WooCommerce Product Categories
<?php
//add the count to our shop menu items
function nim_menu_item_count( $items, $menu, $args ) {
// Only proceed if we are looking at the correct menu and not in the admin
if ( $menu->slug != 'your-menu-slug' || is_admin() )
return $items;
//grab each menu item and it's object_id (which ends up being the category ID for the product category)
foreach ($items as $item) {
@tharmann
tharmann / functions.php
Last active January 11, 2017 21:09
Add a checkbox to WooCommerce order form to process MailChimp API 3.0 list member subscriptions (placed after T&C checkbox if enabled on order form)
<?php
//add action to process mailchimp signup if checked
function mc_checkout_field_process() {
//only run the following if the option to subscribe has been selected
if ( $_POST['mc-subscribe'] == 'on' ) {
//retrieve email, first, and last name from form
$email = $_POST['billing_email'];
$first_name = $_POST['billing_first_name'];
$last_name = $_POST['billing_last_name'];