Shortcodes, Hooks & Filters
In this article:
Shortcodes:
- Display New Auction - This shortcode is used to display new auctions on a page.
Shortcode Format: [uwa_new_auctions days_when_added=”10″ columns=”4″ orderby=”date” order=”desc/asc” show_expired=”yes/no”]
Shortcode Paramters:
days_when_added = Only display 10 days auctions since creation date.
columns = This is default woo-commerce parameter
orderby = This is default woo-commerce parameter
order = This is default woo-commerce parameter
show_expired = Default is yes. If we select “no” then expired auction will not be displayed.
Usage:
We recommend the following procedure to try it out on a new page.
- From your WordPress Dashboard go to Pages > Add New.
- Place the following shortcode on the page: [uwa_new_auctions]Please make sure that the spelling is correct, all letters must be in lower case.
- Click Publish to save the page content and publish the page.
Hooks: Actions:
- If you are going to add some custom text before “Bidding Form”, this hook should help you.
ultimate_woocommerce_auction_before_bid_form
add_action( 'ultimate_woocommerce_auction_before_bid_form', 'here_your_function_name'); function here_your_function_name() { echo 'Some custom text here'; }
- If you are going to add some custom text after “Bidding Form”, this hook should help you.
ultimate_woocommerce_auction_after_bid_form
add_action( 'ultimate_woocommerce_auction_after_bid_form', 'here_your_function_name'); function here_your_function_name() { echo 'Some custom text here'; }
- If you are going to add some custom text before the “Bidding Button”, this hook should help you.
ultimate_woocommerce_auction_before_bid_button
add_action( 'ultimate_woocommerce_auction_before_bid_button', 'here_your_function_name'); function here_your_function_name() { echo 'Some custom text here'; }<br>
- If you are going to add some custom text after the “Bidding Button”, this hook should help you.
ultimate_woocommerce_auction_after_bid_button
add_action( 'ultimate_woocommerce_auction_after_bid_button', 'here_your_function_name'); function here_your_function_name() { echo 'Some custom text here'; }<br>
- You can use this hook while the auction is closing
ultimate_woocommerce_auction_close
add_action( 'ultimate_woocommerce_auction_close', 'here_your_function_name', 50 ); function here_your_function_name($auction_id) { $product = wc_get_product($auction_id); //Your Custom Code here }<br>
- You can use this hook while the admin deletes the bid.
ultimate_woocommerce_auction_delete_bid
add_action( 'ultimate_woocommerce_auction_delete_bid', 'here_your_function_name', 50 ); function here_your_function_name($auction_id) { $product = wc_get_product($auction_id); //Your Custom Code here }<br>
Hooks: Filter:
- Product condition
ultimate_woocommerce_auction_product_condition
add_filter('ultimate_woocommerce_auction_product_condition', 'here_your_function_name' ); function here_your_function_name( $array ){ /* Exiting array keys. 1)new 2)used */ $array['new']='New2'; $array['used']='Used2'; /* You can Add New Condition to Auction Product Like below. */ $arr2 = array('new_factory' => 'Factory Sealed Packaging'); $arr3 = array('vintage' => 'Vintage'); $arr4 = array('appears_new' => 'Appears New'); $array = $array + $arr2 + $arr3 + $arr4; return $array; } <br>
- Bid Button Text
ultimate_woocommerce_auction_bid_button_text
add_filter('ultimate_woocommerce_auction_bid_button_text', 'here_your_function_name' ); function here_your_function_name(){ return __('Button Text', 'woo_ua'); }
- Title for "Bids" Tab in auction detail page
ultimate_woocommerce_auction_total_bids_heading
add_filter('ultimate_woocommerce_auction_total_bids_heading', 'here_your_function_name1' ); function here_your_function_name1(){ return __('Total Bids Placed:', 'woo_ua'); }
- Pay Now Button
ultimate_woocommerce_auction_pay_now_button_text
add_filter('ultimate_woocommerce_auction_pay_now_button_text', 'here_your_function_name' ); function here_your_function_name(){ return __('Pay Now Text', 'woo_ua');