wcpgsk_qtyselector_min

The Woocommerce Poor Guys Swiss Knife wcpgsk qtyselector min function.

Description

wcpgsk_qtyselector_min( $whatever, (null) $product = null ); 

Parameters (2)

0. $whatever
The whatever.
1. $product — Optional. (null) => null
The product.

Usage

  1. if ( !function_exists( 'wcpgsk_qtyselector_min' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-poor-guys-swiss-knife/wcpgsk-af.php'; 
  3.  
  4. // The whatever. 
  5. $whatever = null; 
  6.  
  7. // The product. 
  8. $product = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wcpgsk_qtyselector_min($whatever, $product); 
  12.  

Defined (1)

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

/wcpgsk-af.php  
  1. function wcpgsk_qtyselector_min( $whatever, $product = null ) { 
  2. if ( isset( $product ) && is_object( $product ) ) : 
  3. global $wcpgsk_session; 
  4. $options = get_option( 'wcpgsk_settings' ); 
  5. if ( $product->is_sold_individually() ) : 
  6. $minqty = 1; 
  7. else : 
  8. $minqty = isset($options['cart']['minqty_' . $product->product_type]) && $options['cart']['minqty_' . $product->product_type] != 0 ? $options['cart']['minqty_' . $product->product_type] : 0; 
  9. if ( isset($options['cart']['minmaxstepproduct']) && $options['cart']['minmaxstepproduct'] == 1 ) : 
  10. $product_id = $product->post->ID;  
  11. $minval = get_post_meta($product_id, '_wcpgsk_minqty', true); 
  12. if ( isset($minval) && $minval > 0 ) : 
  13. $minqty = $minval; 
  14. endif; 
  15. endif; 
  16. if ($minqty == '' && isset($wcpgsk_session->qtyargs['min_value']) ) { 
  17. $minqty = $wcpgsk_session->qtyargs['min_value']; 
  18. endif; 
  19. return $minqty; 
  20. else : 
  21. return $whatever; 
  22. endif;