Skip to content

Instantly share code, notes, and snippets.

View iMazed's full-sized avatar

Ines iMazed

View GitHub Profile
@iMazed
iMazed / extend-subscription-intervals.php
Last active February 4, 2020 08:19 — forked from thenbrent/extend-subscription-intervals.php
Add a new billing interval to WooCommerce Subscriptions. Specifically a "every 25 weeks" billing interval to selling a subscription to something and be charged every 10 weeks.
<?php
/**
* Plugin Name: Extend WooCommerce Subscription Intervals
* Description: Add a "every 25" billing interval to WooCommerce Subscriptions
* Author: Brent Shepherd
* Author URI: http://brent.io
* Version: 1.0
* License: GPL v2
*/
<?php
/*
Plugin Name: Primux Mailchimp
Plugin URI: http://primux.dk/
Description: Add new users to a Mailchimp list
Version: 1.0
Author: Primux Media
Author URI: http://primux.dk/
*/
@iMazed
iMazed / updatecart.php
Last active January 20, 2023 11:28 — forked from mikejolley/gist:2044109
WooCommerce: Update cart without page reload
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?></a>
@iMazed
iMazed / functions.php
Last active August 29, 2015 14:15 — forked from kloon/functions.php
WooCommerce: add confirm password field on register form
<?php
// Add the code below to your theme's functions.php file to add a confirm password field on the register form under My Accounts.
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}