wc_format_option_hold_stock_minutes

Formats hold stock option and sets cron event up.

Description

(string) wc_format_option_hold_stock_minutes( (string) $value, (array) $option, (string) $raw_value ); 

Returns (string)

Parameters (3)

0. $value (string)
The value.
1. $option (array)
The option.
2. $raw_value (string)
The raw value.

Usage

  1. if ( !function_exists( 'wc_format_option_hold_stock_minutes' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4. // The value. 
  5. $value = ''; 
  6.  
  7. // The option. 
  8. $option = array(); 
  9.  
  10. // The raw value. 
  11. $raw_value = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wc_format_option_hold_stock_minutes($value, $option, $raw_value); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-formatting-functions.php  
  1. function wc_format_option_hold_stock_minutes( $value, $option, $raw_value ) { 
  2. $value = ! empty( $raw_value ) ? absint( $raw_value ) : ''; // Allow > 0 or set to '' 
  3.  
  4. wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' ); 
  5.  
  6. if ( '' !== $value ) { 
  7. wp_schedule_single_event( time() + ( absint( $value ) * 60 ), 'woocommerce_cancel_unpaid_orders' ); 
  8.  
  9. return $value;