WC_POS_API_Coupons

POS Coupons Class duck punches the WC REST API.

Defined (1)

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

/includes/api/class-wc-pos-coupons.php  
  1. class WC_POS_API_Coupons extends WC_POS_API_Abstract { 
  2.  
  3. /** 
  4. * Returns array of all coupon ids 
  5. * @param $updated_at_min 
  6. * @return array 
  7. */ 
  8. public function get_ids($updated_at_min) { 
  9. $args = array( 
  10. 'post_type' => array('shop_coupon'),  
  11. 'post_status' => array('publish'),  
  12. 'posts_per_page'=> -1,  
  13. 'fields' => 'ids' 
  14. ); 
  15.  
  16. if($updated_at_min) { 
  17. $args['date_query'][] = array( 
  18. 'column' => 'post_modified_gmt',  
  19. 'after' => $updated_at_min,  
  20. 'inclusive' => false 
  21. ); 
  22.  
  23. $query = new WP_Query( $args ); 
  24. return array_map( 'intval', $query->posts ); 
  25.