<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Snippets &#8211; WPInstitut</title>
	<atom:link href="https://wpinstitut.com/category/code-snippets/feed" rel="self" type="application/rss+xml" />
	<link>https://wpinstitut.com</link>
	<description>Auctions For WooCommerce developers home page</description>
	<lastBuildDate>Thu, 19 Mar 2026 13:33:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://www.classicpress.net/?v=6.2.9-cp-2.7.0</generator>

<image>
	<url>https://wpinstitut.com/wp-content/uploads/2020/10/d36b9240f3ebc9057382dcf002d75bb2.png</url>
	<title>Code Snippets &#8211; WPInstitut</title>
	<link>https://wpinstitut.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to hide Pay Now button for auctions?</title>
		<link>https://wpinstitut.com/how-to-hide-pay-now-button-for-auctions</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Thu, 19 Mar 2026 13:32:34 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=3557</guid>

					<description><![CDATA[Some auction website owners need only bidding system and payment is sorted offline so they do now want to display pay now button once auction has finished. To do that you need to edit two templates in your child theme, templates\single-product\pay.php (remove all lines except if with // Exit if accessed directly ) and templates\loop\pay-button.php [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Some auction website owners need only bidding system and payment is sorted offline so they do now want to display pay now button once auction has finished.</p>
<p>To do that you need to edit two templates in your child theme, templates\single-product\pay.php (remove all lines except if with  // Exit if accessed directly ) and templates\loop\pay-button.php &#8211; also remove all except that if statement.</p>
<p>Templates should go to your-child-theme\woocommerce\single-product\pay.php and your-child-theme\woocommerce\loop\pay-button.php</p>
<p>There is also pay button if user watches auction and ajax check is enabled, this one needs to be hidden using CSS:</p>
<pre class="lang:css">.product-type-auction a.button {display: none}</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Competitions for Woo &#8211; Sequential ticket numbers</title>
		<link>https://wpinstitut.com/competitions-for-woo-sequential-ticket-numbers</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Tue, 13 Jan 2026 09:24:53 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=3527</guid>

					<description><![CDATA[This code snippet requires Competitions for Woo v3.0.2 or higher. add_filter( 'competitions_for_woocommerce_generate_random_ticket_numbers', 'custom_sequential_ticket_numbers', 10, 3 ); function custom_sequential_ticket_numbers( $random_tickets, $product_id, $qty ) { $available_tickets = competitions_for_woocommerce_get_available_ticket( $product_id ); if ( empty( $available_tickets ) ) { return $random_tickets; } sort( $available_tickets ); $sequential_tickets = array_slice( $available_tickets, 0, $qty ); return $sequential_tickets; } &#160;]]></description>
										<content:encoded><![CDATA[<p>This code snippet requires Competitions for Woo v3.0.2 or higher.</p>
<pre class="lang:php">add_filter( 'competitions_for_woocommerce_generate_random_ticket_numbers', 'custom_sequential_ticket_numbers', 10, 3 );
function custom_sequential_ticket_numbers( $random_tickets, $product_id, $qty ) {
    $available_tickets = competitions_for_woocommerce_get_available_ticket( $product_id );
    if ( empty( $available_tickets ) ) {
        return $random_tickets;
    }
    sort( $available_tickets );
    $sequential_tickets = array_slice( $available_tickets, 0, $qty );
    return $sequential_tickets;
}</pre>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Change number of lotteries displayed in My Tickets &gt; Active / Past</title>
		<link>https://wpinstitut.com/change-number-of-lotteries-displayed-in-my-tickets-active-past</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Mon, 26 May 2025 07:51:05 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=3444</guid>

					<description><![CDATA[Easy way to change number of items is to go to WordPress Settings > Reading and change option &#8220;Blog pages show at most&#8221;. If that does not work for you there are filters which can be used. You will need Competitions for WooCommerce v3.5 in order to get new filters needed for this code snippet. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Easy way to change number of items is to go to WordPress Settings > Reading and change option &#8220;Blog pages show at most&#8221;. If that does not work for you there are filters which can be used. You will need Competitions for WooCommerce v3.5 in order to get new filters needed for this code snippet. Then change variable $limit to number you want and put code snippet to your child theme functions.php file.</p>
<pre class="lang:php">
add_filter( 'woocommerce_competition_my_tickets_endpoint_post_ids_active', 'my_custom_woocommerce_competition_my_tickets_endpoint_post_ids_active' );
add_filter( 'woocommerce_competition_my_tickets_endpoint_post_ids_past', 'my_custom_woocommerce_competition_my_tickets_endpoint_post_ids_past' );

function my_custom_woocommerce_competition_my_tickets_endpoint_post_ids_active() {

	$limit = 1;
	$current_user_id = get_current_user_id();
	$postids         = competitions_for_woocommerce_get_user_competitions();
	$posts_ids       = array();

	if ( count($postids)&gt;0 ) {

		$args = array(
			'posts_per_page' =&gt; $limit,
			'fields' =&gt; 'ids',
			'post_type'=&gt; 'product',
			'post__in' =&gt; $postids,
			'show_past_competitions' =&gt; false,
			'tax_query' =&gt; array( array('taxonomy' =&gt; 'product_type' , 'field' =&gt; 'slug', 'terms' =&gt; 'competition') ),
		);

		$the_query = new WP_Query( $args );
		$posts_ids = $the_query-&gt;posts;
	}
	$the_query = new WP_Query( $args );
	$posts_ids = $the_query-&gt;posts;

    return $posts_ids; // Always return the content, whether modified or not.
}


function my_custom_woocommerce_competition_my_tickets_endpoint_post_ids_past() {

	$limit = 1;
	$current_user_id = get_current_user_id();
	$postids         = competitions_for_woocommerce_get_user_competitions();
	$posts_ids       = array();

	if ( count( $postids ) &gt; 0 ) {
		// Return past user's competition products.
		$args = array(
			'fields' =&gt; 'ids',
			'post_type'=&gt; 'product',
			'post__in' =&gt; $postids,
			'show_past_competitions' =&gt; true,
			'meta_query' =&gt; array(
				array(
						'key' =&gt; '_competition_closed',
						'operator' =&gt; 'EXISTS',
					),
				),
		);

		$the_query = new WP_Query( $args );
		$posts_ids = $the_query-&gt;posts;
	}

    return $posts_ids; // Always return the content, whether modified or not.
}

</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Prevent proxy bidding to automatically raise bid to the reserve price (if proxy bid amount is higher than reserve price)</title>
		<link>https://wpinstitut.com/prevent-proxy-bidding-to-raise-bid-to-reserve-price</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Tue, 08 Apr 2025 07:05:00 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=3387</guid>

					<description><![CDATA[In case you need proxy bidding not to reach reserve price instantly ie when reserve price is lower than current bid, next bid will be current bid + min bid increase, you can use code below in your child theme functions.php: add_filter( 'auctions_for_woocommerce_proxy_bid_to_reserve' , '__return_false', 20, 3 );]]></description>
										<content:encoded><![CDATA[<p>In case you need proxy bidding not to reach reserve price instantly ie when reserve price is lower than current bid, next bid will be current bid + min bid increase, you can use code below in your child theme functions.php:</p>
<pre class="lang:php">add_filter( 'auctions_for_woocommerce_proxy_bid_to_reserve' , '__return_false', 20, 3 );</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Woodmart bid input fix</title>
		<link>https://wpinstitut.com/woodmart-bid-input-fix</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Thu, 08 Aug 2024 13:29:59 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=3249</guid>

					<description><![CDATA[Here is a bit of CSS and PHP that makes Auctions for WooCommerce bid input look a bit better in Woodmart Theme. Code should go to child theme functions.php and style.css function custom_enqueue_script() { $product = wc_get_product( get_the_ID() ); if ( $product &#38;&#38; $product-&#62;get_type() == 'auction') { wp_add_inline_script( 'wd-woocommerce-quantity', 'jQuery(document).ready(function($) { woodmartThemeModule.$document.off("click", ".plus, .minus"); });'); [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Here is a bit of CSS and PHP that makes Auctions for WooCommerce bid input look a bit better in Woodmart Theme. Code should go to child theme functions.php and style.css</p>
<pre class="lang:php">function custom_enqueue_script() {
    $product = wc_get_product( get_the_ID() );
    if ( $product &amp;&amp; $product-&gt;get_type() == 'auction') {
        wp_add_inline_script( 'wd-woocommerce-quantity', 'jQuery(document).ready(function($) { woodmartThemeModule.$document.off("click", ".plus, .minus"); });');
    }
}
add_action( 'wp_enqueue_scripts', 'custom_enqueue_script', 999 );

add_filter( 'woodmart_ajax_add_to_cart', 'wpi_remove_add_ajax_to_cart', 10 );
function wpi_remove_add_ajax_to_cart ( $data ){
    $product  = wc_get_product( get_the_ID() );
    if ( is_product() ){
        if ( $product &amp;&amp; $product-&gt;is_type('auction') ){
            return false;
        }
    }
    return $data;
}</pre>
<pre class="lang:css">form.auction_form.cart {
    margin: 15px 0;
}

.auction_form .quantity .qty {
    width: 250px !important;
}

input.plus {
    left: 250px;
}
input.minus {
    right: 250px;
}

button.bid_button.button.alt {
    flex: unset;
    left: 355px;
}</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Salient Theme CSS for bid input</title>
		<link>https://wpinstitut.com/salient-theme-css-for-bid-input</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Mon, 27 May 2024 11:55:45 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=3230</guid>

					<description><![CDATA[Here is a bit of CSS that makes Auctions for WooCommerce bid input look a bit better in Salient Theme. .auction_form.cart div.quantity { width: auto !important; border: none; margin: 0 10px 0 0 !important; position: initial !important; opacity: 1 !important; visibility: visible !important; pointer-events: initial !important; float:left !important; } .auction_form .quantity.buttons_added {display: block !important; visibility: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Here is a bit of CSS that makes Auctions for WooCommerce bid input look a bit better in Salient Theme.</p>
<pre class="lang:css">.auction_form.cart div.quantity {
     width: auto !important;
    border: none;
    margin: 0 10px 0 0 !important;
    position: initial !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: initial !important;
    float:left !important;
}

.auction_form .quantity.buttons_added {display: block !important; visibility: visible !important;}</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Bootscore Theme CSS for bid input</title>
		<link>https://wpinstitut.com/bootscore-theme-css-for-bid-input</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Sun, 03 Sep 2023 12:35:47 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=2920</guid>

					<description><![CDATA[Here is a bit of CSS that makes Auctions for WooCommerce bid input look a bit better in Bootscore Theme. input.input-text.qty.bid.text.left {display: inline} .quantity.buttons_added {display: contents} input.plus, input.minus,button.bid_button.button.alt { width: 40px; } button.bid_button.button.alt { margin: 0 0 0 10px; }]]></description>
										<content:encoded><![CDATA[<p>Here is a bit of CSS that makes Auctions for WooCommerce bid input look a bit better in Bootscore Theme.</p>
<pre class="lang:css">input.input-text.qty.bid.text.left  {display: inline}

.quantity.buttons_added {display: contents}

input.plus, input.minus,button.bid_button.button.alt {
    width: 40px;
}

button.bid_button.button.alt {
    margin: 0 0 0 10px;
}</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Redirect to the Cart page when winner clicks Pay Now</title>
		<link>https://wpinstitut.com/redirect-to-the-cart-page-instead-of-directly-to-checkout-when-winning-bidder-clicks-pay-now</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Wed, 07 Jun 2023 07:59:13 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=2668</guid>

					<description><![CDATA[Redirect to the Cart page instead of going directly to Checkout when winning bidder clicks Pay Now, this code snippet requires Auctions for WooCommerce v2.5 or higher: add_filter( 'auctions_for_woocommerce_pay_now_button' , 'custom_auctions_for_woocommerce_pay_now_button', 10); function custom_auctions_for_woocommerce_pay_now_button( $data ){ global $product; if ( ! $product ) { return $data; } return esc_url( add_query_arg( 'pay-auction', $product-&#62;get_auction_id(), wc_get_cart_url() ) ); [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Redirect to the Cart page instead of going directly to Checkout when winning bidder clicks Pay Now, this code snippet requires Auctions for WooCommerce v2.5 or higher:</p>
<pre class="lang:php">add_filter( 'auctions_for_woocommerce_pay_now_button' , 'custom_auctions_for_woocommerce_pay_now_button', 10);
function custom_auctions_for_woocommerce_pay_now_button( $data ){
    global $product;
    if ( ! $product ) {
        return $data;
    }
    return esc_url( add_query_arg( 'pay-auction', $product-&gt;get_auction_id(), wc_get_cart_url() ) );
}
add_filter( 'auctions_for_woocommerce_pay_auction_redirect' , 'custom_auctions_for_woocommerce_pay_auction_redirect', 10);
function custom_auctions_for_woocommerce_pay_auction_redirect( $data ){
    return esc_url( remove_query_arg( array( 'pay-auction', 'quantity', 'product_id' ), wc_get_cart_url() ) );
}</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Add user&#8217;s won auctions to cart</title>
		<link>https://wpinstitut.com/add-users-won-auctions-to-cart</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Mon, 17 Apr 2023 12:53:18 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=2394</guid>

					<description><![CDATA[This is code snippet that adds user&#8217;s won auctions to cart automatically: add_action( 'template_redirect', 'afw_add_won_auctions_to_cart', 10 ); function afw_add_won_auctions_to_cart() { if ( ! is_admin() &#038;& is_user_logged_in() ) { $user_id = get_current_user_id(); $auction_visibility_terms = wc_get_auction_visibility_term_ids(); $product_visibility_in = array( $auction_visibility_terms['sold'] ); $args = array( 'post_type' => 'product', 'posts_per_page' => '-1', 'meta_query' => array( array( 'key' => '_auction_current_bider', [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is code snippet that adds user&#8217;s won auctions to cart automatically:</p>
<pre class="lang:php">add_action( 'template_redirect', 'afw_add_won_auctions_to_cart', 10 );
function afw_add_won_auctions_to_cart() {
    if ( ! is_admin() && is_user_logged_in() ) {
        $user_id = get_current_user_id();
        $auction_visibility_terms  = wc_get_auction_visibility_term_ids();
        $product_visibility_in     = array( $auction_visibility_terms['sold'] );

        $args    = array(
            'post_type'          => 'product',
            'posts_per_page'     => '-1',
            'meta_query'         => array(
                array(
                    'key'   => '_auction_current_bider',
                    'value' => $user_id,
                ),
                array(
                    'key'     => '_auction_payed',
                    'compare' => 'NOT EXISTS',
                ),

            ),
            'tax_query' => array(
                    'taxonomy' => 'auction_visibility',
                    'field'    => 'term_taxonomy_id',
                    'terms'    => $product_visibility_in,
                    'operator' => 'IN',
            ),
            'show_past_auctions' => true,
            'auction_arhive'     => true,
            'fields'                 => 'ids',
            'no_found_rows'          => true,
            'update_post_meta_cache' => false,
            'update_post_term_cache' => false,
        );

        $won_auctions = new WP_Query( $args );

        $posts_ids = $won_auctions->posts;

        if ( is_array( $posts_ids ) ) {

            foreach ( $posts_ids as $posts_id ) {

                $found = false;

                $product = wc_get_product( $posts_id );

                // check if auction ended and has highest bidder

                if ( is_object( WC()->cart ) && is_object( $product ) && method_exists( $product, 'get_auction_closed' ) && method_exists( $product, 'get_auction_payed' ) && ! $product->get_auction_payed() && 2 == $product->get_auction_closed() && ( $product->get_stock_quantity() > 0 ) ){

                        // check if already in cart

                        if ( sizeof( WC()->cart->get_cart() ) > 0 ) {

                            foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
                                $_product = $values['data'];
                                if ( $_product->get_id() == $posts_id ) {
                                    $found = true;
                                }
                            }

                            if ( ! $found ) {
                                WC()->cart->add_to_cart( $posts_id );
                            }

                        } else {
                            WC()->cart->add_to_cart( $posts_id );
                        }



                }
            }
        }
    }
}</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Display &#8220;no results&#8221; message when there are no results in shortcode</title>
		<link>https://wpinstitut.com/display-no-results-message-for-empty-shortcode</link>
		
		<dc:creator><![CDATA[WPInstitut]]></dc:creator>
		<pubDate>Mon, 17 Apr 2023 11:06:28 +0000</pubDate>
				<category><![CDATA[Code Snippets]]></category>
		<guid isPermaLink="false">https://wpinstitut.com/?p=2393</guid>

					<description><![CDATA[To add message if there are no results in shortcode please use code snippet below: function afw_action_woocommerce_shortcode_products_loop_no_results( $attributes ) { echo __( 'No auction(s) found.', 'my-custom-language-domain' ); } add_action( 'woocommerce_shortcode_ending_soon_auctions_loop_no_results', 'afw_action_woocommerce_shortcode_products_loop_no_results', 10, 1 ); add_action( 'woocommerce_shortcode_all_user_auctions_loop_no_results', 'afw_action_woocommerce_shortcode_products_loop_no_results', 10, 1 ); For ending_soon_auctions shortcode hook is woocommerce_shortcode_ending_soon_auctions_loop_no_results, in general hook is woocommerce_shortcode_[shortcode_name]_loop_no_results. This is applicable for [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>To add message if there are no results in shortcode please use code snippet below:</p>
<pre class="lang:php">function afw_action_woocommerce_shortcode_products_loop_no_results( $attributes ) {
    echo __( 'No auction(s) found.', 'my-custom-language-domain' );
}
add_action( 'woocommerce_shortcode_ending_soon_auctions_loop_no_results', 'afw_action_woocommerce_shortcode_products_loop_no_results', 10, 1 );
add_action( 'woocommerce_shortcode_all_user_auctions_loop_no_results', 'afw_action_woocommerce_shortcode_products_loop_no_results', 10, 1 );
</pre>
<p>For ending_soon_auctions shortcode hook is woocommerce_shortcode_ending_soon_auctions_loop_no_results, in general hook is woocommerce_shortcode_[shortcode_name]_loop_no_results. This is applicable for both Auctions for Woo and Competitions for Woo plugins.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
