In the process of WooCommerce development, we often use some functions to implement corresponding functions. Today we will introduce to you:WooCommerce DevelopmentCore functions frequently used in the process are located in the includes/wc-core-functions.php file. We can use these functions in themes or plug-ins.
wc_mail
Use this function to send HTML emails using WooCommerce email templates.
wc_mail( $to, $subject, $message, $headers = "Content-Type: text/htmlrn", $attachments = "" )
wc_get_page_id( $pagename )
Get WooCommerce page ID by page name.
wc_get_page_id( $page )
wc_price( $price, $args )
Format price numbers into correct decimal format and add currency symbols.
wc_price( $price, $args = array() )
The $args array has an optionalex_tax_label– If set to true, a ‘tax included’ message will be displayed.
wc_clean( $var )
Extract and clean tags from string ($var).
wc_clean( $var )
wc_get_dimension( $dim, $to_unit )
Get the dimensions in WooCommerce dimension units (dim) and convert to the required dimension unit ($to_unit).
wc_get_dimension( 10, 'lbs' )
wc_get_weight( $weight, $to_unit )
Get the weight in WooCommerce weight units ($weight) and convert to the required weight unit ($to_unit).
wc_get_weight( 10, 'lbs' )
To be continued…
