Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidperezgar/7f519ad5b0a5021a7288174f0ea11b6b to your computer and use it in GitHub Desktop.
Save davidperezgar/7f519ad5b0a5021a7288174f0ea11b6b to your computer and use it in GitHub Desktop.
Add WooCommerce to bin install-wp-tests.sh
# Installs WooCommerce plugin in the test environment
install_woocommerce() {
local PLUGIN_DIR="$WP_CORE_DIR/wp-content/plugins"
mkdir -p "$PLUGIN_DIR"
if [[ $WP_VERSION == "8.0" ]]; then
WOOCOMMERCE_URL="https://downloads.wordpress.org/plugin/woocommerce.7.9.0.zip"
else
WOOCOMMERCE_URL="https://downloads.wordpress.org/plugin/woocommerce.zip"
fi
download "$WOOCOMMERCE_URL" "$TMPDIR/woocommerce.zip"
unzip -q "$TMPDIR/woocommerce.zip" -d "$TMPDIR/"
rm -rf "$PLUGIN_DIR/woocommerce"
mv "$TMPDIR/woocommerce" "$PLUGIN_DIR/woocommerce"
echo "WooCommerce plugin installed successfully."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment