Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Created June 24, 2013 22:28
Show Gist options
  • Save BFTrick/5854267 to your computer and use it in GitHub Desktop.
Save BFTrick/5854267 to your computer and use it in GitHub Desktop.
You can get a products weight using this snippet. You will need to be in the product loop to access it or on a page like content-single-product.php where you're already within the loop.
global $product;
$attributes = $product->get_attributes();
if ( $product->has_weight() ) {
echo $product->get_weight();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment