Ultimate Auction for WooCommerce Shortcode

Below, you’ll find a detailed guide on how to add the Ultimate Auction for WooCommerce Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Ultimate Auction for WooCommerce Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Ultimate Auction for WooCommerce Plugin and the shortcodes it provides:

Plugin Icon
Ultimate Auction for WooCommerce

"Ultimate Auction for WooCommerce is a robust plugin that augments your eCommerce site, enabling you to seamlessly set up and manage online auctions. Transform your WooCommerce platform with this powerful tool."

★★★★☆ (115) Active Installs: 3000+ Tested with: 6.3.2 PHP Version: 7.0
Included Shortcodes:
  • [uwa_new_auctions]

Ultimate Auction for WooCommerce [uwa_new_auctions] Shortcode

The Ultimate WooCommerce Auction plugin shortcode allows you to display new auctions on your website. It queries for ‘product’ post types, sorts them by date, and filters them based on set parameters like the number of days since added, whether to show expired auctions or not, and the category. The shortcode also supports pagination, allowing users to navigate through multiple pages of auctions.

Shortcode: [uwa_new_auctions]


Here is a list of all possible uwa_new_auctions shortcode parameters and attributes:

  • columns – Defines the number of columns to display the auctions in.
  • orderby – Determines the order of the auctions based on date, title, etc.
  • order – Sets the direction of the order, either ascending or descending.
  • days_when_added – Shows auctions added within the specified number of days.
  • show_expired – Controls whether to display expired auctions or not.
  • paginate – Enables or disables pagination for the auctions list.
  • limit – Sets the maximum number of auctions to display.
  • category – Filters auctions based on their assigned category.

Examples and Usage

Basic example – Displaying new auctions with default parameters.


Advanced examples

Displaying new auctions with specific columns and order. In this case, it will display auctions in 3 columns and ordered by the auction’s date in ascending order.

[uwa_new_auctions columns="3" orderby="date" order="asc"]

Displaying new auctions from a specific category and limiting the number of auctions displayed. Here, it will display auctions from the category with the slug ‘electronics’ and only show 5 auctions.

[uwa_new_auctions category="electronics" limit="5"]

Displaying new auctions added within a specific number of days and excluding expired auctions. This will display auctions added within the last 7 days and will not show any auctions that have expired.

[uwa_new_auctions days_when_added="7" show_expired="no"]

Enabling pagination for the displayed auctions. This will display auctions with pagination enabled, allowing users to navigate through multiple pages of auctions.

[uwa_new_auctions paginate="true"]

PHP Function Code

In case you have difficulties debugging what causing issues with [uwa_new_auctions] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'uwa_new_auctions', array( $this, 'uwa_new_auctions_fun' ) );

Shortcode PHP function:

function uwa_new_auctions_fun( $atts ) {

		global $woocommerce_loop, $woocommerce;		
			//'per_page' 	=> '12',
			'columns' 	=> '4',
			'orderby' => 'date',
			'order' => 'desc',
			'days_when_added' =>'12',
			'show_expired' =>'yes',
			'paginate' => 'false',
		  	'limit' => -1,
		  	'category'  => '',

		), $atts));

		$limit = (int)$limit;  // don't remove

		$meta_query = $woocommerce->query->get_meta_query();
		if($show_expired == 'no'){
        	$meta_query [] = array(
								'key'     => 'woo_ua_auction_closed',
								'compare' => 'NOT EXISTS',
		$days_when_added_pera = "-".$days_when_added." days";
		$after_day = wp_date('Y-m-d', strtotime($days_when_added_pera),get_uwa_wp_timezone());
		$args = array(
			'post_type'	=> 'product',
			'post_status' => 'publish',
			'ignore_sticky_posts'	=> 1,
			//'posts_per_page' => -1,   // -1 is default for all results to display
			'posts_per_page' => $limit,
			'orderby' => $orderby,
			'order' => $order,
			'meta_query' => $meta_query,
			'date_query' => array(
						'after' =>$after_day 
			'tax_query' => array(array('taxonomy' => 'product_type' , 'field' => 'slug', 'terms' => 'auction')),
			'auction_arhive' => TRUE

		/* Set Pagination Variable */
		if($paginate === "true"){
			$paged = get_query_var('paged') ? get_query_var('paged') : 1;
			$args['paged'] = $paged;
			//$woocommerce_loop['paged'] = $paged;

			$args['product_cat']  =  $atts['category'];
		$products = new WP_Query( $args );
		$woocommerce_loop['columns'] = $columns;

		if ( $products->have_posts() ) : ?>

				/* Pagination Top Text */				
				if($paginate === "true" && ($limit >= 1 || $limit === -1 ))  {				
					$args_toptext = array(
						'total'    => $products->found_posts,
						//'per_page' => $products->get( 'posts_per_page' ),
						'per_page' => $limit,
						'current'  => max(1, get_query_var('paged')),
					wc_get_template( 'loop/result-count.php', $args_toptext );

			<?php woocommerce_product_loop_start(); ?>

				<?php while ( $products->have_posts() ) : $products->the_post(); ?>

					<?php wc_get_template_part( 'content', 'product' ); ?>

				<?php endwhile; // end of the loop. ?>

			<?php woocommerce_product_loop_end(); ?>

	   <?php else : ?>

            <?php wc_get_template( 'loop/no-products-found.php' ); ?>

		<?php endif;


		/* ---  Display Pagination ---  */

		if ( $paginate === "true" && $limit >= 1 && $limit < $products->found_posts ) { // don't change condition else design conflicts
			$big = 999999999;
			$current = max(1, get_query_var('paged'));
			$total   = $products->max_num_pages;
			$base    = esc_url_raw( str_replace( $big, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( $big, false ))));
			$format  = '?paged=%#%';			

			if ( $total <= 1 ) {
			$display_data = '<nav class="woocommerce-pagination">';
			$display_data .= paginate_links( 
				apply_filters( 'woocommerce_pagination_args', 
						'base'         => $base,
						'format'       => $format,						
						'add_args'     => false,						
						'current'      => $current,
						'total'        => $total,
						'prev_text'    => '&larr;',
						'next_text'    => '&rarr;',
						//'type'         => 'list',
						'end_size'     => 3,
						'mid_size'     => 3,
			$display_data .= '</nav>';
			echo wp_kses_post($display_data);
		} /* end of if - paginate */

		return '<div class="woocommerce">' . ob_get_clean() . '</div>';

Code file location:



Now that you’ve learned how to embed the Ultimate Auction for WooCommerce Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *