PHP Class WC_Helper_Product

This helper class should ONLY be used for unit tests!.
Show file Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
create_attribute ( ) : array Create a dummy attribute.
create_external_product ( ) : WC_Product_External Create external product.
create_grouped_product ( ) : WC_Product_Grouped Create grouped product.
create_product_review ( $product_id, $review_content = 'Review content here' ) : integer Creates a new product review on a specific product.
create_simple_product ( ) : WC_Product_Simple Create simple product.
create_variation_product ( ) : WC_Product_Variable Create a dummy variation product.
delete_attribute ( $attribute_id ) Delete an attribute.
delete_product ( $product_id ) Delete a product.

Method Details

create_attribute() public static method

Create a dummy attribute.
Since: 2.3
public static create_attribute ( ) : array
return array

create_external_product() public static method

Create external product.
Since: 2.7.0
public static create_external_product ( ) : WC_Product_External
return WC_Product_External

create_grouped_product() public static method

Create grouped product.
Since: 2.7.0
public static create_grouped_product ( ) : WC_Product_Grouped
return WC_Product_Grouped

create_product_review() public static method

Creates a new product review on a specific product.
Since: 2.7
public static create_product_review ( $product_id, $review_content = 'Review content here' ) : integer
$product_id integer Product ID that the review is for
return integer Product Review ID

create_simple_product() public static method

Create simple product.
Since: 2.3
public static create_simple_product ( ) : WC_Product_Simple
return WC_Product_Simple

create_variation_product() public static method

Create a dummy variation product.
Since: 2.3
public static create_variation_product ( ) : WC_Product_Variable
return WC_Product_Variable

delete_attribute() public static method

Delete an attribute.
Since: 2.3
public static delete_attribute ( $attribute_id )
$attribute_id

delete_product() public static method

Delete a product.
public static delete_product ( $product_id )
$product_id