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 BANNER TO CART PAGE | |
add_action('woocommerce_before_cart', 'madcow_above_cart_and_checkout_message'); | |
add_action('woocommerce_after_order_notes', 'madcow_above_cart_and_checkout_message'); | |
function madcow_above_cart_and_checkout_message() { | |
echo 'your-content-here'; | |
} |
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
// CHECK FOR SPECIFIC PRODUCT CATEGORY IN CART | |
function madcow_custom_category_is_in_the_cart($categories) { | |
// Products currently in the cart | |
$cart_ids = array(); | |
// Categories currently in the cart | |
$cart_categories = array(); | |
// Find each product in the cart and add it to the $cart_ids array | |
foreach (WC()->cart->get_cart() as $cart_item_key => $values) { | |
$cart_product = $values['data']; | |
$cart_ids[] = $cart_product->id; |
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
// CHECK FOR SPECIFIC PRODUCT ID IN CART | |
function madcow_custom_product_id_is_in_the_cart($ids) { | |
// Products currently in the cart | |
$cart_ids = array(); | |
// Find each product in the cart and add it to the $cart_ids array | |
foreach (WC()->cart->get_cart() as $cart_item_key => $values) { | |
$cart_product = $values['data']; | |
$cart_ids[] = $cart_product->id; | |
} | |
// If one of the special products are in the cart, return true. |
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 NEATO TEXT CUSTOM TAB | |
add_filter('woocommerce_product_tabs', 'madcow_neato_text_tab'); | |
function madcow_neato_text_tab($tabs) { | |
$tabs['neato_text_tab'] = array( | |
'title' => __('Our Neato Text', 'woocommerce'), | |
'priority' => 5, | |
'callback' => 'madcow_neato_text_tab_content', | |
); | |
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
// move category above product title | |
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40); | |
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 4); |
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_action('init', 'madcowweb_shortcodes'); | |
function madcowweb_shortcodes() { | |
add_shortcode('show-cows', 'show_cows'); | |
} | |
//SIMPLE TEXT | |
function show_cows() { | |
$html = '<h1>I love cows</h1>'; | |
return $html; | |
} |