Skip to content

Commit

Permalink
Merge: New blueprint: use runPHP to add a woocommerce product #28
Browse files Browse the repository at this point in the history
runphp example

blueprint line end

Blueprint metadata
  • Loading branch information
mujuonly authored and adamziel committed Apr 19, 2024
1 parent c938ecf commit f5f2cef
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions blueprints/runphp/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"meta": {
"title": "woocommerce product feed",
"description": "Blueprint to create a woocommerce product and export an XML/CSV product feed",
"author": "mujuonly",
"categories": ["WooCommerce", "Content"]
},
"landingPage": "/wp-admin/admin.php?page=webtoffee_product_feed_main_export",
"preferredVersions": {
"php": "7.4",
"wp": "6.4"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
},
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "woocommerce"
},
"options": {
"activate": true
}
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "webtoffee-product-feed"
},
"options": {
"activate": true
}
},
{
"step": "runPHP",
"code": "<?php include 'wordpress/wp-load.php'; delete_transient( '_wc_activation_redirect' ); wp_insert_post(array( 'import_id' => 5, 'post_title' => 'Sample Product', 'post_content' => '<!-- wp:paragraph --><p>Sample product description</p><!-- /wp:paragraph -->','post_status' => 'publish','post_type' => 'product','post_author' => 1, 'meta_input' => array('_sku' => 'WEBTOFFEE-FEED-ITEM', '_regular_price' => 25.00, '_sale_price' => 22.00, '_price' => 22.00, '_wt_feed_brand' => 'WebToffee', '_wt_feed_gtin' => 'WEBTOFFEE123', '_wt_feed_mpn' => 'WebToffee123', '_wt_feed_color' => 'Red', '_wt_feed_gender' => 'Male' ) ) );"
}
]
}

0 comments on commit f5f2cef

Please sign in to comment.