Skip to content

lagiosdi/woocommerce-variable-product-programmatically

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Woocommerce Variable Product and Variations Programmatically

Creating variable products in woocommerce is easy but adding adding variations is a totally different thing, this script can help you to do that.

Usage

You can copy these functions in your functions.php file inside your theme or create a plugin using the functions

//Adding product
$product = pricode_create_product();

//Creating Attributes 
$atts = [];
$atts[] = pricode_create_attributes('color',['red', 'green']);
$atts[] = pricode_create_attributes('size',['S', 'M']);

//Adding attributes to the created product
$product->set_attributes( $atts );
$product->save();

//Create variations
pricode_create_variations( $product->get_id(), ['color' => 'red', 'size' => 'M']);

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%