Skip to content

Instantly share code, notes, and snippets.

@JeroenSormani
JeroenSormani / woocommerce-remove-added-to-cart-notice.php
Created Jun 18, 2021
Remove the "Added to cart" notice in WooCommerce
View woocommerce-remove-added-to-cart-notice.php
<?php // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Remove add to cart notice in WooCommerce
*/
add_filter( 'wc_add_to_cart_message_html', '__return_empty_string' );
@JeroenSormani
JeroenSormani / eddeet-remove-tracking-script-1.2.php
Created Jun 25, 2019
EDD Enhanced Ecommerce Tracking 1.2+ - (Re)move tracking script to the head
View eddeet-remove-tracking-script-1.2.php
<?php
// Copy from here
if ( function_exists( 'EDD_Enhanced_Ecommerce_Tracking' ) && edd_get_option( 'eddeet_implementation_method' ) == 'measurement-protocol' ) {
remove_action( 'wp_footer', array( EDD_Enhanced_Ecommerce_Tracking()->implementation, 'output_script' ) );
// Add to header -- Remove/comment the below if you want to completely remove the tracking script.
add_action( 'wp_head', array( EDD_Enhanced_Ecommerce_Tracking()->implementation, 'output_script' ) );
}
View conversio-custom-receipt-triggers.php
<?php
if ( function_exists( 'Conversio' ) ) {
// Remove all existing triggers
remove_action( 'woocommerce_order_status_pending_to_processing', array( Conversio()->email, 'send_transactional_email' ) );
remove_action( 'woocommerce_order_status_on-hold_to_processing', array( Conversio()->email, 'send_transactional_email' ) );
remove_action( 'woocommerce_order_status_pending_to_completed', array( Conversio()->email, 'send_transactional_email' ) );
// Add custom triggers - change accordingly to your own needs
add_action( 'woocommerce_order_status_pending_to_completed', array( Conversio()->email, 'send_transactional_email' ) ); // Specific status change
@JeroenSormani
JeroenSormani / scheduled-site-wide-banner-wordpress-woocommerce.php
Created May 7, 2019
A scheduled site-wide banner in WooCommerce / WordPress
View scheduled-site-wide-banner-wordpress-woocommerce.php
<?php // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Basic site-wide banner.
*/
function ace_custom_site_banner() {
$from_time = new DateTime( '2019-04-21 00:00' );
$to_time = new DateTime( '2019-04-22 23:59' );
if ( new DateTime() > $from_time && new DateTime() < $to_time ) {
@JeroenSormani
JeroenSormani / site-wide-banner-wordpress-woocommerce.php
Created May 7, 2019
A site-wide banner in WooCommerce / WordPress
View site-wide-banner-wordpress-woocommerce.php
<?php // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Basic site-wide banner.
*/
function ace_custom_site_banner() {
?><div class="site-banner">
<span>
<strong style="">Sale!</strong> Get up to 50% off, sale ending this friday.
</span>
@JeroenSormani
JeroenSormani / product-quantity-through-url-parameter-for-woocommerce.php
Created Apr 30, 2019
Set product quantity value through URL parameter in WooCommerce
View product-quantity-through-url-parameter-for-woocommerce.php
<?php // For implementation instructions see; https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Product quantity through URL parameter.
*
* Allow for setting a suggested product quantity in the product quantity field by adding
* a &quantity=5 URL parameter.
*
* @param array $args Original arguments.
* @param WC_Product $product Product being viewed.
@JeroenSormani
JeroenSormani / disable-emoji-wordpress.php
Created May 10, 2018
Emoji disabling code snippet for WordPress
View disable-emoji-wordpress.php
<?php // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Disable WP 4.2 emoji
*/
function ace_remove_emoji() {
add_filter( 'emoji_svg_url', '__return_false' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@JeroenSormani
JeroenSormani / woocommerce-dropdown-quantity-field-template.php
Last active Jun 13, 2021
Dropdown quantity input field template - WooCommerce
View woocommerce-dropdown-quantity-field-template.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
if ( $max_value && $min_value === $max_value ) {
?><div class="quantity hidden"><input type="hidden" id="<?php echo esc_attr( $input_id ); ?>" class="qty" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $min_value ); ?>" /></div><?php
} elseif ( ! empty( $max_value ) && ! empty( $step ) ) {
?><div class="quantity">
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></label>
<select name="<?php echo esc_attr( $input_name ); ?>" class="qty" id="<?php echo esc_attr( $input_id ); ?>"><?php
for ( $i = $min_value; $i <= $max_value; $i = $i + $step ) :
@JeroenSormani
JeroenSormani / shortcode-profile-editor.php
Created Nov 13, 2017
Easy Digital Downloads Bootstrap templates - The EDD template files in Bootstrap 4 format. Based on EDD version 2.8.x
View shortcode-profile-editor.php
<?php
/**
* This template is used to display the profile editor with [edd_profile_editor]
*/
global $current_user;
if ( is_user_logged_in() ):
$user_id = get_current_user_id();
$first_name = get_user_meta( $user_id, 'first_name', true );
$last_name = get_user_meta( $user_id, 'last_name', true );
@JeroenSormani
JeroenSormani / index.html
Created Aug 6, 2017
Related to https://github.com/electron/electron/issues/8847 - showing a imprint / shadow of the previous state prior to show/hide
View index.html
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: rgba(255, 0, 0, 0.5);
font-size: 30px;
}
</style>
</head>