• Hi Xootix,

    I used the below “Spend x for delivery” snippet on the basket page and would like to add this same snippet in the WC Side Cart (in the blank area below the basket/checkout CTAs). Is it possible?

    // Woocommerce - cart page notification
    add_action( 'woocommerce_before_cart_table', 'cart_page_notice' );
     
    function cart_page_notice() {
    	$min_amount = 20; //This is the amount of your free shipping threshold. Change according to your free shipping settings
    	$current = WC()->cart->subtotal;
    	if ( $current < $min_amount ) {
    		$added_text = '<div class="woocommerce-message">Spend  ' . wc_price( $min_amount - $current ) . ' more to get fast & free shipping<br/>'; // This is the message shown on the single product page
    		$return_to = wc_get_page_permalink( 'shop' );
    		$notice = sprintf( '%s<a href="%s">%s</a>', $added_text, esc_url( $return_to ), 'Continue shopping</div>' ); // This is the text shown below the notification. Link redirects to the shop page
    		echo $notice;
    	}
    }
    • This topic was modified 3 years, 8 months ago by fizzers.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Extra content hooks’ is closed to new replies.