Skip to content

Instantly share code, notes, and snippets.

@szepeviktor
Created February 26, 2025 21:53
Show Gist options
  • Save szepeviktor/07743e9999290fae083bf35c99ca6472 to your computer and use it in GitHub Desktop.
Save szepeviktor/07743e9999290fae083bf35c99ca6472 to your computer and use it in GitHub Desktop.
Dump WooCommerce product attributes
#!/bin/bash
DUMP_FILE="/home/user/product-attr-debug/$(date --utc +%F).product"
TOTAL="$(wp wc product list --format=count)"
for PAGE in $(seq 1 $(( (TOTAL+99) / 100 ))); do
wp wc product list --page=${PAGE} --fields=id,attributes >>"${DUMP_FILE}"
done
@szepeviktor
Copy link
Author

This could be a daily cron job to monitor changes in product attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment