×

 

Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

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 SC Commerce email templates.

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

wc_get_page_id( $pagename )

Gets a SC 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 SC 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 SC Commerce’s weight unit and converts it to the target weight unit  ($to_unit).

wc_get_weight( 10, 'lbs' )