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 | |
// Change the description tab title to product name | |
add_filter( 'woocommerce_product_tabs', 'wc_change_product_description_tab_title', 10, 1 ); | |
function wc_change_product_description_tab_title( $tabs ) { | |
global $post; | |
if ( isset( $tabs['description']['title'] ) ) | |
$tabs['description']['title'] = $post->post_title; | |
return $tabs; | |
} |
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
#! /bin/bash | |
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn | |
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo. | |
# main config | |
PLUGINSLUG="camptix-payfast-gateway" | |
CURRENTDIR=`pwd` | |
MAINFILE="camptix-payfast.php" # this should be the name of your main php file in the wordpress plugin | |
# git config |
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 | |
// Add previous and next links to products under the product details | |
add_action( 'woocommerce_single_product_summary', 'wc_next_prev_products_links', 60 ); | |
function wc_next_prev_products_links() { | |
previous_post_link( '%link', '< Previous' ); | |
echo ' | '; | |
next_post_link( '%link', 'Next >' ); | |
} | |
?> |
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 | |
// Place the following code in your theme's functions.php file | |
// override the quantity input with a dropdown | |
function woocommerce_quantity_input() { | |
global $product; | |
$defaults = array( | |
'input_name' => 'quantity', | |
'input_value' => '1', | |
'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), |
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 | |
add_action( 'woocommerce_check_cart_items', 'wc_limit_total_products_purchased_check' ); | |
function wc_limit_total_products_purchased_check() { | |
global $woocommerce; | |
$step = 40; | |
$total_items = $woocommerce->cart->get_cart_contents_count(); | |
if ( $total_items % $step ) | |
$woocommerce->add_error( sprintf( __( 'Your must purchase in groups of %s products, please add or remove products to continue.', 'woocommerce' ), $step ) ); | |
} | |
? |
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_shortcode( 'list_vendors', 'wc_list_vendors_shortcode' ); | |
function wc_list_vendors_shortcode( $atts ) { | |
$vendors = ''; | |
$terms = get_terms( 'shop_vendor' ); | |
foreach ( $terms as $term ) { | |
$term_link = get_term_link( $term, 'shop_vendor' ); | |
if ( is_wp_error( $term_link ) ) | |
continue; | |
$vendors .= '<h2><a href="' . $term_link . '">' . $term->name . '</a></h2>'; | |
} |
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
// Enable Automatic Updates for all updates | |
define( 'WP_AUTO_UPDATE_CORE', true ); | |
// Disable Automatic Updates for all updates | |
define( 'WP_AUTO_UPDATE_CORE', false ); | |
// Only allow Automatic Updates for minor updates | |
define( 'WP_AUTO_UPDATE_CORE', 'minor' ); |
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
//Allow auto updates of development releases ie alpha, beta and RC | |
add_filter( 'allow_dev_auto_core_updates', 'wp_control_dev_auto_updates' ); | |
function wp_control_dev_auto_updates( $value ) { | |
// return true to enable and false to disable | |
return true; | |
} | |
//Allow auto updates of minor releases ie 3.7.1, 3.7.2 | |
add_filter( 'allow_minor_auto_core_updates', 'wp_control_minor_auto_updates' ); | |
function wp_control_minor_auto_updates( $value ) { |
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 | |
add_filter( 'woocommerce_available_shipping_methods', 'wc_hide_free_shipping_based_on_weight' , 10, 1 ); | |
function wc_hide_free_shipping_based_on_weight( $available_methods ) { | |
if ( isset( $available_methods['free_shipping'] ) { | |
global $woocommerce; | |
$weight = 0; | |
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) { | |
foreach ( $woocommerce->cart->get_cart() as $item_id => $values ) { | |
$_product = $values['data']; | |
if ( $_product->exists() && $values['quantity'] > 0 ) { |
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 | |
// Place the following code in your theme's functions.php file to add the payment type to all emails | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_emails', 15, 2 ); | |
function wc_add_payment_type_to_emails( $order, $is_admin_email ) { | |
echo '<p><strong>Payment Type:</strong> ' . $order->payment_method_title . '</p>'; | |
} | |
// Place the following code in your theme's functions.php file to add the payment type to admin emails only | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_admin_emails', 15, 2 ); | |
function wc_add_payment_type_to_admin_emails( $order, $is_admin_email ) { |