Skip to content

Instantly share code, notes, and snippets.

@hirejordansmith
Last active April 22, 2024 14:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hirejordansmith/880f3ecec9031a9755997915eba6c847 to your computer and use it in GitHub Desktop.
Save hirejordansmith/880f3ecec9031a9755997915eba6c847 to your computer and use it in GitHub Desktop.
WooCommerce Class Values
<?php
// Returns subtotal price ($5.00)
$cart_subtotal = WC()->cart->get_cart_subtotal();
// Returns subtotal number value (5)
$cart_subtotal = WC()->cart->subtotal;
/*========================================
Single Product
========================================*/
// Return Single Product Price in number format(5)
$product->get_price();
// Return Single Product Price in display format ($5.00)
$product->get_price_html();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment