Property | Type | Description | |
---|---|---|---|
$extra_data_saved | If we have already saved our extra data, don't do automatic / default handling. | ||
$internal_meta_keys | array | Data stored in meta keys, but not considered "meta". |
Method | Description | |
---|---|---|
create ( &$product ) | Method to create a new product in the database. | |
delete ( &$product, array $args = [] ) | Method to delete a product from the database. | |
find_matching_product_variation ( WC_Product $product, array $match_attributes = [] ) : integer | Find a matching (enabled) variation within a variable product. | |
get_ending_sales ( ) : array | Returns an array of IDs of products that have sales which are due to end. | |
get_featured_product_ids ( ) : array | Returns a list of product IDs ( id as key => parent as value) that are featured. Uses get_posts instead of wc_get_products since we want some extra meta queries and ALL products (posts_per_page = -1). | |
get_on_sale_products ( ) : array | Returns an array of on sale products, as an array of objects with an ID and parent_id present. Example: $return[0]->id, $return[0]->parent_id. | |
get_product_id_by_sku ( string $sku ) : integer | Return product ID based on SKU. | |
get_products ( array $args = [] ) : array | Returns an array of products. | |
get_related_products ( array $cats_array, array $tags_array, array $exclude_ids, integer $limit, integer $product_id ) : array | Return a list of related products (using data like categories and IDs). | |
get_related_products_query ( array $cats_array, array $tags_array, array $exclude_ids, integer $limit ) : string | Builds the related posts query. | |
get_shipping_class_id_by_slug ( $slug ) : integer | false | Get shipping class ID by slug. | |
get_starting_sales ( ) : array | Returns an array of IDs of products that have sales starting soon. | |
is_existing_sku ( integer $product_id, string $sku ) : boolean | Check if product sku is found for any other product IDs. | |
read ( &$product ) | Method to read a product from the database. | |
search_products ( string $term, string $type = '', boolean $include_variations = false ) : array | Search product data for a term and return ids. | |
update ( &$product ) | Method to update a product in the database. | |
update_average_rating ( WC_Product $product ) | Update a products average rating meta. | |
update_product_stock ( $product_id_with_stock, integer | null $stock_quantity = null, string $operation = 'set' ) | Update a product's stock amount directly. | |
update_rating_counts ( WC_Product $product ) | Update a products rating counts. | |
update_review_count ( WC_Product $product ) | Update a products review count meta. |
Method | Description | |
---|---|---|
clear_caches ( &$product ) | Clear any caches. | |
read_attributes ( &$product ) | Read attributes from post meta. | |
read_downloads ( &$product ) | Read downloads from post meta. | |
read_product_data ( &$product ) | Read product data. Can be overridden by child classes to load other props. | |
update_attributes ( &$product ) | Update attributes which are a mix of terms and meta data. | |
update_downloads ( &$product ) | Update downloads. | |
update_post_meta ( &$product ) | Helper method that updates all the post meta for a product based on it's settings in the WC_Product class. | |
update_term_counts ( &$product ) | Count terms. These are done at this point so all product props are set in advance. | |
update_terms ( &$product ) | For all stored terms in all taxonomies, save them to the DB. | |
update_version_and_type ( &$product ) | Make sure we store the product type and version (to track data changes). |
public find_matching_product_variation ( WC_Product $product, array $match_attributes = [] ) : integer | ||
$product | WC_Product | Variable product. |
$match_attributes | array | Array of attributes we want to try to match. |
return | integer | Matching variation ID or 0. |
public get_ending_sales ( ) : array | ||
return | array |
public get_featured_product_ids ( ) : array | ||
return | array |
public get_on_sale_products ( ) : array | ||
return | array |
public get_product_id_by_sku ( string $sku ) : integer | ||
$sku | string | |
return | integer |
public get_products ( array $args = [] ) : array | ||
$args | array | @see wc_get_products |
return | array |
public get_shipping_class_id_by_slug ( $slug ) : integer | false | ||
$slug | string | |
return | integer | false |
public get_starting_sales ( ) : array | ||
return | array |
protected read_attributes ( &$product ) |
protected read_downloads ( &$product ) |
protected read_product_data ( &$product ) |
protected update_attributes ( &$product ) |
public update_average_rating ( WC_Product $product ) | ||
$product | WC_Product |
protected update_post_meta ( &$product ) |
public update_rating_counts ( WC_Product $product ) | ||
$product | WC_Product |
public update_review_count ( WC_Product $product ) | ||
$product | WC_Product |
protected update_term_counts ( &$product ) |
protected update_terms ( &$product ) |
protected update_version_and_type ( &$product ) |
protected $extra_data_saved |
protected array $internal_meta_keys | ||
return | array |