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 | |
/* | |
* wc_remove_related_products | |
* | |
* Clear the query arguments for related products so none show. | |
* Add this code to your theme functions.php file. | |
*/ | |
function wc_remove_related_products( $args ) { | |
return 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 | |
/* | |
* Use this in __construct() to set appropriate options update | |
*/ | |
if ( preg_match('/1\.[0-9]*\.[0-9]*/', WOOCOMMERCE_VERSION )){ | |
// 1.*.* | |
add_action('woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options')); | |
} else { | |
// 2.*.* |
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_order_actions', array( $this, 'my_order_actions' )); | |
add_action('woocommerce_process_shop_order_meta', array( $this, 'my_process_order_meta'), 20, 2 ); | |
function my_order_actions( $post_id ) { | |
?> | |
<li class="wide"><input type="submit" class="button tips" name="my_button" value="<?php _e('Do Something', 'woocommerce'); ?>" data-tip="<?php _e('Put tip here.', 'woocommerce'); ?>" /></li> | |
<?php |
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_before_checkout_form', 'my_custom_shipping_message' ); | |
function my_custom_shipping_message( ) { | |
global $woocommerce; | |
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) { | |
$_product = $values['data']; |
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 | |
// first remove the action defined in woocommerce-hooks.php | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); | |
// modeled off of the woocommerce_upsell_display() function in woocommerce-template.php | |
// change $columns to desired number of columns | |
function my_woocommerce_upsell_display( $posts_per_page = '-1', $columns = 5, $orderby = 'rand' ) { | |
woocommerce_get_template( 'single-product/up-sells.php', array( | |
'posts_per_page' => $posts_per_page, |
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
// Twitter Feed | |
add_shortcode( 'tweet-tweet', 'infom_get_twitter_feed' ); | |
function infom_get_twitter_feed( $atts ) { | |
extract(shortcode_atts(array( | |
'handle' => 'krogsgard', | |
'count' => '1' | |
), $atts)); | |
$handle = sanitize_text_field( $handle ); | |
$count = intval( $count ); |
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 this to your theme's functions.php file | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); | |
function custom_output_related_products() { | |
// Display 5 products in 5 columns | |
woocommerce_related_products( 5, 5 ); | |
} | |
add_action( 'woocommerce_after_single_product_summary', 'custom_output_related_products', 20 ); |
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_shortcode( 'growdev_category_list', 'growdev_category_list'); | |
function growdev_category_list( $atts ) { | |
global $woocommerce_loop; | |
extract( shortcode_atts( array ( | |
'number' => null, |
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 a note to the order. Put return code here if needed. | |
$order->add_order_note( __('Payment completed', 'woocommerce') ); | |
// Mark the order as complete | |
$order->payment_complete(); | |
// Empty the cart | |
$woocommerce->cart->empty_cart(); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer