Description
I am trying to migrate a WooCommerce setup bash script to a blueprint and I have wp-cli commands like the following that don't work:
{
"step": "wp-cli",
"command": "wp option update woocommerce_terms_page_id $(wp post list --pagename='sample-page' --format=ids)"
},
{
"step": "wp-cli",
"command": "wp option update page_on_front $(wp option get woocommerce_shop_page_id)"
},
{
"step": "wp-cli",
"command": "wp post update $(wp option get woocommerce_checkout_page_id --format=ids) --post_content='[woocommerce_checkout]'"
}
When I try to run a blueprint with such a step, eg as the below
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"preferredVersions": {
"php": "8.0",
"wp": "latest"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
},
"plugins": [
"woocommerce"
],
"steps": [
{
"step": "setSiteOptions",
"options": {
"show_on_front": "page",
"woocommerce_onboarding_profile": {
"skipped": true
},
"woocommerce_default_country": "SE",
"woocommerce_currency": "SEK",
"woocommerce_price_num_decimals": "2"
}
},
{
"step": "wp-cli",
"command": "wp transient delete _wc_activation_redirect"
},
{
"step": "wp-cli",
"command": "wp wc product create --name='Simple product' --sku='simple-product' --regular_price='99.99' --virtual=false --downloadable=false --user='admin'"
},
{
"step": "wp-cli",
"command": "wp option update woocommerce_terms_page_id $(wp post list --pagename='sample-page' --format=ids)"
},
{
"step": "wp-cli",
"command": "wp option update page_on_front $(wp option get woocommerce_shop_page_id)"
},
{
"step": "wp-cli",
"command": "wp post update $(wp option get woocommerce_checkout_page_id --format=ids) --post_content='[woocommerce_checkout]'"
}
],
"login": true,
"landingPage": "/wp-admin/admin.php?page=wc-settings&tab=checkout"
}
I get the error:
Error: Error when executing the blueprint step #6 ({"step":"wp-cli","command":"wp option update page_on_front $(wp option get woocommerce_shop_page_id)"}) : PHP.run() failed with exit code 1 and the following output: �[31;1mError:�[0m Too many positional arguments: option get woocommerce_shop_page_id) #!/usr/bin/env php
So I am guessing command substitution like this is not supported in wp-cli steps? Is it something that could be supported and/or do you have any suggestions on how I should go about it instead? Maybe use a php step that does the same thing?