A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Useful Core Functions

The following useful functions are found in includes/wc-core-functions.php and can be used by themes and plugins.

wc_mail

Used to send an email using the Classic Commerce email templates.

wc_mail( $to, $subject, $message, $headers = "Content-Type: text/htmlrn", $attachments = "" )

wc_get_page_id( $pagename )

Gets a Classic Commerce page ID by name, e.g. thankyou

wc_get_page_id( $page )

wc_price( $price, $args )

Formats a passed price with the correct number of decimals and currency symbol.

wc_price( $price, $args = array() )

The $args array has an option called ex_tax_label – if true then an ‘excluding tax’ message will be appended.

wc_clean( $var )

Trims and strips tags from a string ($var).

wc_clean( $var )

wc_get_dimension( $dim, $to_unit )

Takes a measurement (dim) measured in Classic Commerce’s dimension unit and converts it to the target unit  ($to_unit).

wc_get_dimension( 10, 'lbs' )

wc_get_weight( $weight, $to_unit )

Takes a weight ($weight) weighed in Classic Commerce’s weight unit and converts it to the target weight unit  ($to_unit).

wc_get_weight( 10, 'lbs' )