Skip to content

Instantly share code, notes, and snippets.

@sburlot
Last active April 23, 2024 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sburlot/627d931c15e2ce84b98dbd0d8cbbf696 to your computer and use it in GitHub Desktop.
Save sburlot/627d931c15e2ce84b98dbd0d8cbbf696 to your computer and use it in GitHub Desktop.
Get number of yesterday sales from WooCommerce
# you'll need jq installed
# and keys for WooCommerce API access
#
# Stephan Burlot coriolis.ch Apr 2024
#
# this works on MacOSX
curl -s "https://example.ch/wp-json/wc/v3/orders?\
consumer_key=ck_CONSUMER_KEY&\
consumer_secret=cs_SECRET_KEY&\
after=$(date -v-1d '+%Y-%m-%dT00:00:00')" | \
jq '. | length'
# Ubuntu:
curl -s "https://example.ch/wp-json/wc/v3/orders?\
consumer_key=ck_CONSUMER_KEY&\
consumer_secret=cs_SECRET_KEY&\
after=$(date --date='yesterday' '+%Y-%m-%dT00:00:00')" | \
jq '. | length'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment