This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Reset payment method in session | |
add_action('woocommerce_checkout_init', function(){ | |
if( ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || ( defined( 'DOING_AJAX') && DOING_AJAX ) || !WC() || !WC()->session || is_admin() ) { | |
return; | |
} | |
// Get first payment method and store it | |
// Since payment method selection is not persistent, on page load always the first one will be selected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'woocommerce_product_subcategories_args', 'custom_woocommerce_product_subcategories_args' ); | |
function custom_woocommerce_product_subcategories_args( $args ) { | |
$args['exclude'] = get_option( 'default_product_cat' ); | |
return $args; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Double serialized attributes fixer | |
* Description: Adds a tool to fix double serialized attributes in WooCommerce. | |
* Version: 0.0.9 | |
* Author: Mike J | |
* Requires at least: 4.4 | |
* Tested up to: 4.7 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'woocommerce_defer_transactional_emails', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' ); | |
function woocommerce_created_customer_admin_notification( $customer_id ) { | |
wp_send_new_user_notifications( $customer_id, 'admin' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'woocommerce_get_price_suffix', 'custom_woocommerce_get_price_suffix', 10, 2 ); | |
function custom_woocommerce_get_price_suffix( $price_display_suffix, $product ) { | |
if ( ! $product->is_taxable() ) { | |
return ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_action( 'template_redirect', 'redirect_external_products' ); | |
function redirect_external_products() { | |
global $post; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'woocommerce_get_order_item_totals', 'custom_woocommerce_get_order_item_totals' ); | |
function custom_woocommerce_get_order_item_totals( $totals ) { | |
unset( $totals['payment_method'] ); | |
return $totals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
* Product must have upsells, and this works with simple products only. | |
* Example link: yoursite.com?add-upsells-to-cart=X, X being your product ID. | |
*/ | |
add_action( 'wp_loaded', 'bulk_upsell_add_to_cart_action', 20 ); | |
function bulk_upsell_add_to_cart_action() { |
NewerOlder