Show Category Description

if ( ! function_exists( 'my_show_category_description_in_shop' ) ) {
function my_show_category_description_in_shop( $category ) {
?>
<h2 class="woocommerce-loop-category__description">
<?php
echo esc_html( $category->description );
?>
</h2>
<?php
}
}
add_action( 'woocommerce_shop_loop_subcategory_title', 'my_show_category_description_in_shop', 20 );

Redirect Thank you

/*CUSTOM THANK YOU PAGE */
function wcs_redirect_product_based ( $order_id ){
global $wp;
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
$order = wc_get_order( $order_id );
foreach( $order->get_items() as $item ) {
$_product = wc_get_product( $item['product_id'] );
// Add whatever product id you want below here
if ( ($item['product_id'] == 3598)||($item['product_id'] == 3599)||($item['product_id'] == 3600) ||($item['product_id'] == 7402)||($item['product_id'] == 7201)||($item['product_id'] == 9447)||($item['product_id'] == 9542)) {
// change below to the URL that you want to send your customer to
wp_redirect(site_url("/url here/"));
}
}
}
}
add_action( 'woocommerce_thankyou', 'wcs_redirect_product_based' );

/*END CUSTOM THANK YOU PAGE*/

Apply Coupon Code via link

//HOW TO USE: https://examplestore.com/cart/?coupon_code=5dollarOff
function webroom_woocommerce_coupon_links(){
// Bail if WooCommerce or sessions aren't available.
if (!function_exists('WC') || !WC()->session) {
return;
}
/**
* Filter the coupon code query variable name.
*
* @since 1.0.0
*
* @param string $query_var Query variable name.
*/
$query_var = apply_filters('woocommerce_coupon_links_query_var', 'coupon_code');
// Bail if a coupon code isn't in the query string.
if (empty($_GET[$query_var])) {
return;
}
// Set a session cookie to persist the coupon in case the cart is empty.
WC()->session->set_customer_session_cookie(true);
// Apply the coupon to the cart if necessary.
if (!WC()->cart->has_discount($_GET[$query_var])) {
// WC_Cart::add_discount() sanitizes the coupon code.
WC()->cart->add_discount($_GET[$query_var]);
}
}
add_action('wp_loaded', 'webroom_woocommerce_coupon_links', 30);
add_action('woocommerce_add_to_cart', 'webroom_woocommerce_coupon_links');

Review My Order

0

Subtotal

 
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.