'; } function alchem_after_shop_loop_item(){ echo ''; } function alchem_after_catalog_ordering(){ } function alchem_woocommerce_before_shop_loop(){ echo "
','
',$content); return $content; } add_filter('woocommerce_short_description', 'alchem_short_desc_filter'); function alchem_url_set_value($url,$key,$value) { $a=explode('?',$url); $url_f=$a[0]; $query=isset($a[1])?$a[1]:""; parse_str($query,$arr); $arr[$key]=$value; return $url_f.'?'.http_build_query($arr); } function alchem_get_self_url(){ if (isset($_SERVER['REQUEST_URI'])) { $serverrequri = $_SERVER['REQUEST_URI']; } else { if (isset($_SERVER['argv'])) { $serverrequri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0]; } else if(isset($_SERVER['QUERY_STRING'])) { $serverrequri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING']; } } $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strstr(strtolower($_SERVER["SERVER_PROTOCOL"]), "/",true).$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$serverrequri; } function alchem_header_shopping_cart(){ global $woocommerce; } /** * Register the [woocommerce_recently_viewed_products per_page="5"] shortcode * * This shortcode displays recently viewed products using WooCommerce default cookie * It only has one parameter "per_page" to choose number of items to show * * @access public * @since 1.0 * @return $content */ function alchem_woocommerce_recently_viewed_products( ) { // Get WooCommerce Global global $woocommerce; // Get recently viewed product cookies data $viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ) : array(); $viewed_products = array_filter( array_map( 'absint', $viewed_products ) ); // If no data, quit if ( empty( $viewed_products ) ) return __( 'You have not viewed any product yet!', 'alchem' ); // Create the object // Get products per page if( !isset( $per_page ) ? $number = 4 : $number = $per_page ) // Create query arguments array $query_args = array( 'posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'rand' ); // Add meta_query to query args $query_args['meta_query'] = array(); // Check products stock status $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); // Create a new query $r = new WP_Query($query_args); // If query return results if ( $r->have_posts() ) { woocommerce_product_loop_start(); // Start the loop while ( $r->have_posts()) { $r->the_post(); wc_get_template_part( 'content', 'product' ); } woocommerce_product_loop_end(); } wp_reset_query(); } add_action("woocommerce_cart_is_empty", "alchem_woocommerce_recently_viewed_products"); function alchem_before_cart(){} add_action("woocommerce_before_cart", "alchem_before_cart",0); function alchem_before_checkout_form(){} add_action("woocommerce_before_checkout_form", "alchem_before_checkout_form",20); function alchem_before_thankyou(){} add_action("woocommerce_before_thankyou", "alchem_before_thankyou"); function alchem_after_nav_menu(){} add_action("alchem_before_nav_menu", "alchem_after_nav_menu");