woocommerce_umf_get_product

Functie om de producten te tonen.

Description

woocommerce_umf_get_product( $product_id, (array) $args = array() ); 

Parameters (2)

0. $product_id
The product id.
1. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'woocommerce_umf_get_product' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-upload-my-file/inc/umf-funct.php'; 
  3.  
  4. // The product id. 
  5. $product_id = null; 
  6.  
  7. // The args. 
  8. $args = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = woocommerce_umf_get_product($product_id, $args); 
  12.  

Defined (1)

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

/inc/umf-funct.php  
  1. function woocommerce_umf_get_product( $product_id, $args = array() ) { 
  2. $product = null; 
  3. if ( version_compare( WOOCOMMERCE_VERSION, "2.0.0" ) >= 0 ) { 
  4. // WC 2.0 
  5. $product = get_product( $product_id, $args ); 
  6. } else { 
  7. // old style, get the product or product variation object 
  8. if ( isset( $args['parent_id'] ) && $args['parent_id'] ) { 
  9. $product = new WC_Product_Variation( $product_id, $args['parent_id'] ); 
  10. } else { 
  11. // get the regular product, but if it has a parent, return the product variation object 
  12. $product = new WC_Product( $product_id ); 
  13. if ( $product->get_parent() ) { 
  14. $product = new WC_Product_Variation( $product->id, $product->get_parent() ); 
  15. return $product;