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
add_filter( 'woocommerce_product_get_stock_status', 'my_plugin_set_stock_status', 10, 2 ); | |
add_filter( 'woocommerce_product_variation_get_stock_status', 'my_plugin_set_stock_status', 10, 2 ); | |
/** | |
* Set maximum back orders. | |
* | |
* @param $stock_status string product stock status. | |
* @param $product integer product. | |
* | |
* @return mixed|string |
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
add_filter( 'woocommerce_cart_no_shipping_available_html', 'myplugin_no_shipping_available_message' ); | |
add_filter( 'woocommerce_no_shipping_available_html', 'myplugin_no_shipping_available_message' ); | |
/** | |
* Update the Woocommerce No Shipping message to include contact details. | |
*/ | |
function myplugin_no_shipping_available_message( $message ) { | |
$country = WC()->customer->get_shipping_country(); | |
$mailto = 'mailto:' . get_option( 'admin_email' ); // Could also be 'woocommerce_stock_email_recipient'. | |
$link = sprintf( wp_kses( __( '<a href="%s">contact us</a>', 'my-plugin' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( $mailto ) ); |
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: Simple Google Analytics Plugin | |
* Plugin URI: http://dianewallace.com | |
* Description: Adds a Google analytics tracking code to the <head> of your theme, by hooking to wp_head. | |
* Author: Diane wallace | |
* Version: 1.0 | |
*/ | |
add_action( 'wp_head', 'sga_google_analytics', 10 ); |
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
add_filter( 'woocommerce_cart_shipping_packages', 'split_shipping_packages_shipping_class' ); | |
function split_shipping_packages_shipping_class( $packages ) { | |
// Reset the packages. | |
$packages = array(); | |
// Special items. | |
$special_items = array(); | |
$regular_items = array(); |