Merge branch 'function-call-refactor'
Conflicts: includes/admin/post-types/meta-boxes/class-wc-meta-box-order-data.php includes/shortcodes/class-wc-shortcode-cart.php includes/wc-template-functions.php
This commit is contained in:
commit
4afbd0b556
|
@ -499,7 +499,7 @@ jQuery( function($){
|
||||||
$.each( add_item_ids, function( index, value ) {
|
$.each( add_item_ids, function( index, value ) {
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
action: 'woocommerce_add_order_item',
|
action: 'wc_add_order_item',
|
||||||
item_to_add: value,
|
item_to_add: value,
|
||||||
order_id: woocommerce_admin_meta_boxes.post_id,
|
order_id: woocommerce_admin_meta_boxes.post_id,
|
||||||
security: woocommerce_admin_meta_boxes.order_item_nonce
|
security: woocommerce_admin_meta_boxes.order_item_nonce
|
||||||
|
@ -558,7 +558,7 @@ jQuery( function($){
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
order_item_id: $item.attr( 'data-order_item_id' ),
|
order_item_id: $item.attr( 'data-order_item_id' ),
|
||||||
action: 'woocommerce_add_order_item_meta',
|
action: 'wc_add_order_item_meta',
|
||||||
security: woocommerce_admin_meta_boxes.order_item_nonce
|
security: woocommerce_admin_meta_boxes.order_item_nonce
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
||||||
if ( $order ) {
|
if ( $order ) {
|
||||||
$return_url = $order->get_checkout_order_received_url();
|
$return_url = $order->get_checkout_order_received_url();
|
||||||
} else {
|
} else {
|
||||||
$return_url = woocommerce_get_endpoint_url( 'order-received', '', get_permalink( woocommerce_get_page_id( 'checkout' ) ) );
|
$return_url = wc_get_endpoint_url( 'order-received', '', get_permalink( wc_get_page_id( 'checkout' ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' ) {
|
if ( is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' ) {
|
||||||
|
|
|
@ -279,7 +279,7 @@ class WC_Product {
|
||||||
|
|
||||||
// Set default name
|
// Set default name
|
||||||
if ( empty( $file['name'] ) ) {
|
if ( empty( $file['name'] ) ) {
|
||||||
$downloadable_files[ $key ]['name'] = woocommerce_get_filename_from_url( $file );
|
$downloadable_files[ $key ]['name'] = wc_get_filename_from_url( $file );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter URL
|
// Filter URL
|
||||||
|
@ -856,8 +856,8 @@ class WC_Product {
|
||||||
);
|
);
|
||||||
|
|
||||||
$replace = array(
|
$replace = array(
|
||||||
woocommerce_price( $this->get_price_including_tax() ),
|
wc_price( $this->get_price_including_tax() ),
|
||||||
woocommerce_price( $this->get_price_excluding_tax() )
|
wc_price( $this->get_price_excluding_tax() )
|
||||||
);
|
);
|
||||||
|
|
||||||
$price_display_suffix = str_replace( $find, $replace, $price_display_suffix );
|
$price_display_suffix = str_replace( $find, $replace, $price_display_suffix );
|
||||||
|
@ -890,7 +890,7 @@ class WC_Product {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$price .= woocommerce_price( $display_price ) . $this->get_price_suffix();
|
$price .= wc_price( $display_price ) . $this->get_price_suffix();
|
||||||
|
|
||||||
$price = apply_filters( 'woocommerce_price_html', $price, $this );
|
$price = apply_filters( 'woocommerce_price_html', $price, $this );
|
||||||
|
|
||||||
|
@ -937,7 +937,7 @@ class WC_Product {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_price_html_from_to( $from, $to ) {
|
public function get_price_html_from_to( $from, $to ) {
|
||||||
return '<del>' . ( ( is_numeric( $from ) ) ? woocommerce_price( $from ) : $from ) . '</del> <ins>' . ( ( is_numeric( $to ) ) ? woocommerce_price( $to ) : $to ) . '</ins>';
|
return '<del>' . ( ( is_numeric( $from ) ) ? wc_price( $from ) : $from ) . '</del> <ins>' . ( ( is_numeric( $to ) ) ? wc_price( $to ) : $to ) . '</ins>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1332,7 +1332,7 @@ class WC_Product {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function list_attributes() {
|
public function list_attributes() {
|
||||||
woocommerce_get_template( 'single-product/product-attributes.php', array(
|
wc_get_template( 'single-product/product-attributes.php', array(
|
||||||
'product' => $this
|
'product' => $this
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,7 +684,7 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
||||||
if ( $_POST[ $this->plugin_id . $this->id . '_' . $key ] !== '' )
|
if ( $_POST[ $this->plugin_id . $this->id . '_' . $key ] !== '' )
|
||||||
$text = woocommerce_format_decimal( trim( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) );
|
$text = wc_format_decimal( trim( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) );
|
||||||
else
|
else
|
||||||
$text = '';
|
$text = '';
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,7 @@ abstract class WC_Settings_API {
|
||||||
|
|
||||||
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
||||||
if ( $_POST[ $this->plugin_id . $this->id . '_' . $key ] !== '' )
|
if ( $_POST[ $this->plugin_id . $this->id . '_' . $key ] !== '' )
|
||||||
$text = woocommerce_format_decimal( trim( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) );
|
$text = wc_format_decimal( trim( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) );
|
||||||
else
|
else
|
||||||
$text = '';
|
$text = '';
|
||||||
}
|
}
|
||||||
|
@ -725,7 +725,7 @@ abstract class WC_Settings_API {
|
||||||
$text = $this->get_option( $key );
|
$text = $this->get_option( $key );
|
||||||
|
|
||||||
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
||||||
$text = woocommerce_clean( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
$text = wc_clean( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
@ -772,7 +772,7 @@ abstract class WC_Settings_API {
|
||||||
$value = $this->get_option( $key );
|
$value = $this->get_option( $key );
|
||||||
|
|
||||||
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
||||||
$value = woocommerce_clean( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
$value = wc_clean( stripslashes( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -792,7 +792,7 @@ abstract class WC_Settings_API {
|
||||||
$value = $this->get_option( $key );
|
$value = $this->get_option( $key );
|
||||||
|
|
||||||
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
if ( isset( $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) ) {
|
||||||
$value = array_map( 'woocommerce_clean', array_map( 'stripslashes', (array) $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
$value = array_map( 'wc_clean', array_map( 'stripslashes', (array) $_POST[ $this->plugin_id . $this->id . '_' . $key ] ) );
|
||||||
} else {
|
} else {
|
||||||
$value = '';
|
$value = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ class WC_Admin_Assets {
|
||||||
wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering.js', array('jquery-ui-sortable'), WC()->version );
|
wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering.js', array('jquery-ui-sortable'), WC()->version );
|
||||||
wp_enqueue_script( 'woocommerce_term_ordering' );
|
wp_enqueue_script( 'woocommerce_term_ordering' );
|
||||||
|
|
||||||
$taxonomy = isset( $_GET['taxonomy'] ) ? woocommerce_clean( $_GET['taxonomy'] ) : '';
|
$taxonomy = isset( $_GET['taxonomy'] ) ? wc_clean( $_GET['taxonomy'] ) : '';
|
||||||
|
|
||||||
$woocommerce_term_order_params = array(
|
$woocommerce_term_order_params = array(
|
||||||
'taxonomy' => $taxonomy
|
'taxonomy' => $taxonomy
|
||||||
|
|
|
@ -52,7 +52,7 @@ class WC_Admin_Attributes {
|
||||||
|
|
||||||
// Grab the submitted data
|
// Grab the submitted data
|
||||||
$attribute_label = ( isset( $_POST['attribute_label'] ) ) ? (string) stripslashes( $_POST['attribute_label'] ) : '';
|
$attribute_label = ( isset( $_POST['attribute_label'] ) ) ? (string) stripslashes( $_POST['attribute_label'] ) : '';
|
||||||
$attribute_name = ( isset( $_POST['attribute_name'] ) ) ? woocommerce_sanitize_taxonomy_name( stripslashes( (string) $_POST['attribute_name'] ) ) : '';
|
$attribute_name = ( isset( $_POST['attribute_name'] ) ) ? wc_sanitize_taxonomy_name( stripslashes( (string) $_POST['attribute_name'] ) ) : '';
|
||||||
$attribute_type = ( isset( $_POST['attribute_type'] ) ) ? (string) stripslashes( $_POST['attribute_type'] ) : '';
|
$attribute_type = ( isset( $_POST['attribute_type'] ) ) ? (string) stripslashes( $_POST['attribute_type'] ) : '';
|
||||||
$attribute_orderby = ( isset( $_POST['attribute_orderby'] ) ) ? (string) stripslashes( $_POST['attribute_orderby'] ) : '';
|
$attribute_orderby = ( isset( $_POST['attribute_orderby'] ) ) ? (string) stripslashes( $_POST['attribute_orderby'] ) : '';
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class WC_Admin_Attributes {
|
||||||
$attribute_label = ucfirst( $attribute_name );
|
$attribute_label = ucfirst( $attribute_name );
|
||||||
}
|
}
|
||||||
if ( ! $attribute_name ) {
|
if ( ! $attribute_name ) {
|
||||||
$attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $attribute_label ) );
|
$attribute_name = wc_sanitize_taxonomy_name( stripslashes( $attribute_label ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forbidden attribute names
|
// Forbidden attribute names
|
||||||
|
@ -92,7 +92,7 @@ class WC_Admin_Attributes {
|
||||||
}
|
}
|
||||||
if ( 'edit' === $action ) {
|
if ( 'edit' === $action ) {
|
||||||
$old_attribute_name = $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" );
|
$old_attribute_name = $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" );
|
||||||
if ( $old_attribute_name != $attribute_name && woocommerce_sanitize_taxonomy_name( $old_attribute_name ) != $attribute_name && $taxonomy_exists ) {
|
if ( $old_attribute_name != $attribute_name && wc_sanitize_taxonomy_name( $old_attribute_name ) != $attribute_name && $taxonomy_exists ) {
|
||||||
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
|
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class WC_Admin_Dashboard {
|
||||||
<li class="sales-this-month">
|
<li class="sales-this-month">
|
||||||
<a href="<?php echo admin_url( 'admin.php?page=wc-reports&tab=orders&range=month' ); ?>">
|
<a href="<?php echo admin_url( 'admin.php?page=wc-reports&tab=orders&range=month' ); ?>">
|
||||||
<?php echo $reports->sales_sparkline( '', max( 7, date( 'd', current_time('timestamp') ) ) ); ?>
|
<?php echo $reports->sales_sparkline( '', max( 7, date( 'd', current_time('timestamp') ) ) ); ?>
|
||||||
<?php printf( __( "<strong>%s</strong> sales this month", 'woocommerce' ), woocommerce_price( $sales ) ); ?>
|
<?php printf( __( "<strong>%s</strong> sales this month", 'woocommerce' ), wc_price( $sales ) ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php if ( $top_seller && $top_seller->qty ) : ?>
|
<?php if ( $top_seller && $top_seller->qty ) : ?>
|
||||||
|
|
|
@ -127,7 +127,7 @@ class WC_Admin_Menus {
|
||||||
|
|
||||||
$menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
|
$menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
|
||||||
$menu_name_count = '';
|
$menu_name_count = '';
|
||||||
if ( $order_count = woocommerce_processing_order_count() ) {
|
if ( $order_count = wc_processing_order_count() ) {
|
||||||
$menu_name_count = " <span class='awaiting-mod update-plugins count-$order_count'><span class='processing-count'>" . number_format_i18n( $order_count ) . "</span></span>" ;
|
$menu_name_count = " <span class='awaiting-mod update-plugins count-$order_count'><span class='processing-count'>" . number_format_i18n( $order_count ) . "</span></span>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class WC_Admin_Permalink_Settings {
|
||||||
$product_permalink = $permalinks['product_base'];
|
$product_permalink = $permalinks['product_base'];
|
||||||
|
|
||||||
// Get shop page
|
// Get shop page
|
||||||
$shop_page_id = woocommerce_get_page_id( 'shop' );
|
$shop_page_id = wc_get_page_id( 'shop' );
|
||||||
$base_slug = ( $shop_page_id > 0 && get_page( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : _x( 'shop', 'default-slug', 'woocommerce' );
|
$base_slug = ( $shop_page_id > 0 && get_page( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : _x( 'shop', 'default-slug', 'woocommerce' );
|
||||||
$product_base = _x( 'product', 'default-slug', 'woocommerce' );
|
$product_base = _x( 'product', 'default-slug', 'woocommerce' );
|
||||||
|
|
||||||
|
@ -160,9 +160,9 @@ class WC_Admin_Permalink_Settings {
|
||||||
// We need to save the options ourselves; settings api does not trigger save for the permalinks page
|
// We need to save the options ourselves; settings api does not trigger save for the permalinks page
|
||||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) && isset( $_POST['product_permalink'] ) ) {
|
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) && isset( $_POST['product_permalink'] ) ) {
|
||||||
// Cat and tag bases
|
// Cat and tag bases
|
||||||
$woocommerce_product_category_slug = woocommerce_clean( $_POST['woocommerce_product_category_slug'] );
|
$woocommerce_product_category_slug = wc_clean( $_POST['woocommerce_product_category_slug'] );
|
||||||
$woocommerce_product_tag_slug = woocommerce_clean( $_POST['woocommerce_product_tag_slug'] );
|
$woocommerce_product_tag_slug = wc_clean( $_POST['woocommerce_product_tag_slug'] );
|
||||||
$woocommerce_product_attribute_slug = woocommerce_clean( $_POST['woocommerce_product_attribute_slug'] );
|
$woocommerce_product_attribute_slug = wc_clean( $_POST['woocommerce_product_attribute_slug'] );
|
||||||
|
|
||||||
$permalinks = get_option( 'woocommerce_permalinks' );
|
$permalinks = get_option( 'woocommerce_permalinks' );
|
||||||
if ( ! $permalinks )
|
if ( ! $permalinks )
|
||||||
|
@ -173,10 +173,10 @@ class WC_Admin_Permalink_Settings {
|
||||||
$permalinks['attribute_base'] = untrailingslashit( $woocommerce_product_attribute_slug );
|
$permalinks['attribute_base'] = untrailingslashit( $woocommerce_product_attribute_slug );
|
||||||
|
|
||||||
// Product base
|
// Product base
|
||||||
$product_permalink = woocommerce_clean( $_POST['product_permalink'] );
|
$product_permalink = wc_clean( $_POST['product_permalink'] );
|
||||||
|
|
||||||
if ( $product_permalink == 'custom' ) {
|
if ( $product_permalink == 'custom' ) {
|
||||||
$product_permalink = woocommerce_clean( $_POST['product_permalink_structure'] );
|
$product_permalink = wc_clean( $_POST['product_permalink_structure'] );
|
||||||
} elseif ( empty( $product_permalink ) ) {
|
} elseif ( empty( $product_permalink ) ) {
|
||||||
$product_permalink = false;
|
$product_permalink = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ class WC_Admin_Profile {
|
||||||
foreach( $save_fields as $fieldset )
|
foreach( $save_fields as $fieldset )
|
||||||
foreach( $fieldset['fields'] as $key => $field )
|
foreach( $fieldset['fields'] as $key => $field )
|
||||||
if ( isset( $_POST[ $key ] ) )
|
if ( isset( $_POST[ $key ] ) )
|
||||||
update_user_meta( $user_id, $key, woocommerce_clean( $_POST[ $key ] ) );
|
update_user_meta( $user_id, $key, wc_clean( $_POST[ $key ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -648,7 +648,7 @@ class WC_Admin_Settings {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( isset( $_POST[$value['id']] ) ) {
|
if ( isset( $_POST[$value['id']] ) ) {
|
||||||
$option_value = woocommerce_clean( stripslashes( $_POST[ $value['id'] ] ) );
|
$option_value = wc_clean( stripslashes( $_POST[ $value['id'] ] ) );
|
||||||
} else {
|
} else {
|
||||||
$option_value = '';
|
$option_value = '';
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ class WC_Admin_Settings {
|
||||||
|
|
||||||
// Get countries array
|
// Get countries array
|
||||||
if ( isset( $_POST[ $value['id'] ] ) )
|
if ( isset( $_POST[ $value['id'] ] ) )
|
||||||
$selected_countries = array_map( 'woocommerce_clean', array_map( 'stripslashes', (array) $_POST[ $value['id'] ] ) );
|
$selected_countries = array_map( 'wc_clean', array_map( 'stripslashes', (array) $_POST[ $value['id'] ] ) );
|
||||||
else
|
else
|
||||||
$selected_countries = array();
|
$selected_countries = array();
|
||||||
|
|
||||||
|
@ -675,8 +675,8 @@ class WC_Admin_Settings {
|
||||||
|
|
||||||
if ( isset( $_POST[$value['id'] ]['width'] ) ) {
|
if ( isset( $_POST[$value['id'] ]['width'] ) ) {
|
||||||
|
|
||||||
$update_options[ $value['id'] ]['width'] = woocommerce_clean( stripslashes( $_POST[ $value['id'] ]['width'] ) );
|
$update_options[ $value['id'] ]['width'] = wc_clean( stripslashes( $_POST[ $value['id'] ]['width'] ) );
|
||||||
$update_options[ $value['id'] ]['height'] = woocommerce_clean( stripslashes( $_POST[ $value['id'] ]['height'] ) );
|
$update_options[ $value['id'] ]['height'] = wc_clean( stripslashes( $_POST[ $value['id'] ]['height'] ) );
|
||||||
|
|
||||||
if ( isset( $_POST[ $value['id'] ]['crop'] ) )
|
if ( isset( $_POST[ $value['id'] ]['crop'] ) )
|
||||||
$update_options[ $value['id'] ]['crop'] = 1;
|
$update_options[ $value['id'] ]['crop'] = 1;
|
||||||
|
|
|
@ -88,7 +88,7 @@ class WC_Admin {
|
||||||
$prevent_access = apply_filters( 'woocommerce_prevent_admin_access', $prevent_access );
|
$prevent_access = apply_filters( 'woocommerce_prevent_admin_access', $prevent_access );
|
||||||
|
|
||||||
if ( $prevent_access ) {
|
if ( $prevent_access ) {
|
||||||
wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
||||||
array(
|
array(
|
||||||
'tax_rate_country' => $country,
|
'tax_rate_country' => $country,
|
||||||
'tax_rate_state' => $state,
|
'tax_rate_state' => $state,
|
||||||
'tax_rate' => woocommerce_format_decimal( $rate, 4 ),
|
'tax_rate' => wc_format_decimal( $rate, 4 ),
|
||||||
'tax_rate_name' => trim( $name ),
|
'tax_rate_name' => trim( $name ),
|
||||||
'tax_rate_priority' => absint( $priority ),
|
'tax_rate_priority' => absint( $priority ),
|
||||||
'tax_rate_compound' => $compound ? 1 : 0,
|
'tax_rate_compound' => $compound ? 1 : 0,
|
||||||
|
@ -149,9 +149,9 @@ if ( class_exists( 'WP_Importer' ) ) {
|
||||||
|
|
||||||
$tax_rate_id = $wpdb->insert_id;
|
$tax_rate_id = $wpdb->insert_id;
|
||||||
|
|
||||||
$postcode = woocommerce_clean( $postcode );
|
$postcode = wc_clean( $postcode );
|
||||||
$postcodes = explode( ';', $postcode );
|
$postcodes = explode( ';', $postcode );
|
||||||
$postcodes = array_map( 'strtoupper', array_map( 'woocommerce_clean', $postcodes ) );
|
$postcodes = array_map( 'strtoupper', array_map( 'wc_clean', $postcodes ) );
|
||||||
foreach( $postcodes as $postcode ) {
|
foreach( $postcodes as $postcode ) {
|
||||||
if ( ! empty( $postcode ) && $postcode != '*' ) {
|
if ( ! empty( $postcode ) && $postcode != '*' ) {
|
||||||
$wpdb->insert(
|
$wpdb->insert(
|
||||||
|
@ -165,9 +165,9 @@ if ( class_exists( 'WP_Importer' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$city = woocommerce_clean( $city );
|
$city = wc_clean( $city );
|
||||||
$cities = explode( ';', $city );
|
$cities = explode( ';', $city );
|
||||||
$cities = array_map( 'strtoupper', array_map( 'woocommerce_clean', $cities ) );
|
$cities = array_map( 'strtoupper', array_map( 'wc_clean', $cities ) );
|
||||||
foreach( $cities as $city ) {
|
foreach( $cities as $city ) {
|
||||||
if ( ! empty( $city ) && $city != '*' ) {
|
if ( ! empty( $city ) && $city != '*' ) {
|
||||||
$wpdb->insert(
|
$wpdb->insert(
|
||||||
|
|
|
@ -151,7 +151,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
if ( isset( $_POST['_visibility'] ) )
|
if ( isset( $_POST['_visibility'] ) )
|
||||||
update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
|
update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
|
||||||
if ( isset( $_POST['_stock_status'] ) )
|
if ( isset( $_POST['_stock_status'] ) )
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_POST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -573,7 +573,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
$search_ids[] = $term;
|
$search_ids[] = $term;
|
||||||
}
|
}
|
||||||
// Attempt to get a SKU
|
// Attempt to get a SKU
|
||||||
$sku_to_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value LIKE '%%%s%%' LIMIT 1;", woocommerce_clean( $term ) ) );
|
$sku_to_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_sku' AND meta_value LIKE '%%%s%%' LIMIT 1;", wc_clean( $term ) ) );
|
||||||
|
|
||||||
if ( $sku_to_id )
|
if ( $sku_to_id )
|
||||||
$search_ids[] = $sku_to_id;
|
$search_ids[] = $sku_to_id;
|
||||||
|
@ -678,46 +678,46 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
$old_sale_price = $product->sale_price;
|
$old_sale_price = $product->sale_price;
|
||||||
|
|
||||||
// Save fields
|
// Save fields
|
||||||
if ( isset( $_REQUEST['_sku'] ) ) update_post_meta( $post_id, '_sku', woocommerce_clean( $_REQUEST['_sku'] ) );
|
if ( isset( $_REQUEST['_sku'] ) ) update_post_meta( $post_id, '_sku', wc_clean( $_REQUEST['_sku'] ) );
|
||||||
if ( isset( $_REQUEST['_weight'] ) ) update_post_meta( $post_id, '_weight', woocommerce_clean( $_REQUEST['_weight'] ) );
|
if ( isset( $_REQUEST['_weight'] ) ) update_post_meta( $post_id, '_weight', wc_clean( $_REQUEST['_weight'] ) );
|
||||||
if ( isset( $_REQUEST['_length'] ) ) update_post_meta( $post_id, '_length', woocommerce_clean( $_REQUEST['_length'] ) );
|
if ( isset( $_REQUEST['_length'] ) ) update_post_meta( $post_id, '_length', wc_clean( $_REQUEST['_length'] ) );
|
||||||
if ( isset( $_REQUEST['_width'] ) ) update_post_meta( $post_id, '_width', woocommerce_clean( $_REQUEST['_width'] ) );
|
if ( isset( $_REQUEST['_width'] ) ) update_post_meta( $post_id, '_width', wc_clean( $_REQUEST['_width'] ) );
|
||||||
if ( isset( $_REQUEST['_height'] ) ) update_post_meta( $post_id, '_height', woocommerce_clean( $_REQUEST['_height'] ) );
|
if ( isset( $_REQUEST['_height'] ) ) update_post_meta( $post_id, '_height', wc_clean( $_REQUEST['_height'] ) );
|
||||||
if ( isset( $_REQUEST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', woocommerce_clean( $_REQUEST['_visibility'] ) );
|
if ( isset( $_REQUEST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', wc_clean( $_REQUEST['_visibility'] ) );
|
||||||
if ( isset( $_REQUEST['_featured'] ) ) update_post_meta( $post_id, '_featured', 'yes' ); else update_post_meta( $post_id, '_featured', 'no' );
|
if ( isset( $_REQUEST['_featured'] ) ) update_post_meta( $post_id, '_featured', 'yes' ); else update_post_meta( $post_id, '_featured', 'no' );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['_tax_status'] ) )
|
if ( isset( $_REQUEST['_tax_status'] ) )
|
||||||
update_post_meta( $post_id, '_tax_status', woocommerce_clean( $_REQUEST['_tax_status'] ) );
|
update_post_meta( $post_id, '_tax_status', wc_clean( $_REQUEST['_tax_status'] ) );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['_tax_class'] ) )
|
if ( isset( $_REQUEST['_tax_class'] ) )
|
||||||
update_post_meta( $post_id, '_tax_class', woocommerce_clean( $_REQUEST['_tax_class'] ) );
|
update_post_meta( $post_id, '_tax_class', wc_clean( $_REQUEST['_tax_class'] ) );
|
||||||
|
|
||||||
if ( $product->is_type('simple') || $product->is_type('external') ) {
|
if ( $product->is_type('simple') || $product->is_type('external') ) {
|
||||||
|
|
||||||
if ( isset( $_REQUEST['_regular_price'] ) ) update_post_meta( $post_id, '_regular_price', woocommerce_clean( $_REQUEST['_regular_price'] ) );
|
if ( isset( $_REQUEST['_regular_price'] ) ) update_post_meta( $post_id, '_regular_price', wc_clean( $_REQUEST['_regular_price'] ) );
|
||||||
if ( isset( $_REQUEST['_sale_price'] ) ) update_post_meta( $post_id, '_sale_price', woocommerce_clean( $_REQUEST['_sale_price'] ) );
|
if ( isset( $_REQUEST['_sale_price'] ) ) update_post_meta( $post_id, '_sale_price', wc_clean( $_REQUEST['_sale_price'] ) );
|
||||||
|
|
||||||
// Handle price - remove dates and set to lowest
|
// Handle price - remove dates and set to lowest
|
||||||
$price_changed = false;
|
$price_changed = false;
|
||||||
|
|
||||||
if ( isset( $_REQUEST['_regular_price'] ) && woocommerce_clean( $_REQUEST['_regular_price'] ) != $old_regular_price ) $price_changed = true;
|
if ( isset( $_REQUEST['_regular_price'] ) && wc_clean( $_REQUEST['_regular_price'] ) != $old_regular_price ) $price_changed = true;
|
||||||
if ( isset( $_REQUEST['_sale_price'] ) && woocommerce_clean( $_REQUEST['_sale_price'] ) != $old_sale_price ) $price_changed = true;
|
if ( isset( $_REQUEST['_sale_price'] ) && wc_clean( $_REQUEST['_sale_price'] ) != $old_sale_price ) $price_changed = true;
|
||||||
|
|
||||||
if ( $price_changed ) {
|
if ( $price_changed ) {
|
||||||
update_post_meta( $post_id, '_sale_price_dates_from', '' );
|
update_post_meta( $post_id, '_sale_price_dates_from', '' );
|
||||||
update_post_meta( $post_id, '_sale_price_dates_to', '' );
|
update_post_meta( $post_id, '_sale_price_dates_to', '' );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['_sale_price'] ) && $_REQUEST['_sale_price'] != '' ) {
|
if ( isset( $_REQUEST['_sale_price'] ) && $_REQUEST['_sale_price'] != '' ) {
|
||||||
update_post_meta( $post_id, '_price', woocommerce_clean( $_REQUEST['_sale_price'] ) );
|
update_post_meta( $post_id, '_price', wc_clean( $_REQUEST['_sale_price'] ) );
|
||||||
} else {
|
} else {
|
||||||
update_post_meta( $post_id, '_price', woocommerce_clean( $_REQUEST['_regular_price'] ) );
|
update_post_meta( $post_id, '_price', wc_clean( $_REQUEST['_regular_price'] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle stock status
|
// Handle stock status
|
||||||
if ( isset( $_REQUEST['_stock_status'] ) )
|
if ( isset( $_REQUEST['_stock_status'] ) )
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_REQUEST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_REQUEST['_stock_status'] ) );
|
||||||
|
|
||||||
// Handle stock
|
// Handle stock
|
||||||
if ( ! $product->is_type('grouped') ) {
|
if ( ! $product->is_type('grouped') ) {
|
||||||
|
@ -730,7 +730,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['_backorders'] ) ) {
|
if ( ! empty( $_REQUEST['_backorders'] ) ) {
|
||||||
update_post_meta( $post_id, '_backorders', woocommerce_clean( $_REQUEST['_backorders'] ) );
|
update_post_meta( $post_id, '_backorders', wc_clean( $_REQUEST['_backorders'] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,29 +747,29 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
|
|
||||||
// Save fields
|
// Save fields
|
||||||
if ( ! empty( $_REQUEST['change_weight'] ) && isset( $_REQUEST['_weight'] ) )
|
if ( ! empty( $_REQUEST['change_weight'] ) && isset( $_REQUEST['_weight'] ) )
|
||||||
update_post_meta( $post_id, '_weight', woocommerce_clean( stripslashes( $_REQUEST['_weight'] ) ) );
|
update_post_meta( $post_id, '_weight', wc_clean( stripslashes( $_REQUEST['_weight'] ) ) );
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['change_dimensions'] ) ) {
|
if ( ! empty( $_REQUEST['change_dimensions'] ) ) {
|
||||||
if ( isset( $_REQUEST['_length'] ) )
|
if ( isset( $_REQUEST['_length'] ) )
|
||||||
update_post_meta( $post_id, '_length', woocommerce_clean( stripslashes( $_REQUEST['_length'] ) ) );
|
update_post_meta( $post_id, '_length', wc_clean( stripslashes( $_REQUEST['_length'] ) ) );
|
||||||
if ( isset( $_REQUEST['_width'] ) )
|
if ( isset( $_REQUEST['_width'] ) )
|
||||||
update_post_meta( $post_id, '_width', woocommerce_clean( stripslashes( $_REQUEST['_width'] ) ) );
|
update_post_meta( $post_id, '_width', wc_clean( stripslashes( $_REQUEST['_width'] ) ) );
|
||||||
if ( isset( $_REQUEST['_height'] ) )
|
if ( isset( $_REQUEST['_height'] ) )
|
||||||
update_post_meta( $post_id, '_height', woocommerce_clean( stripslashes( $_REQUEST['_height'] ) ) );
|
update_post_meta( $post_id, '_height', wc_clean( stripslashes( $_REQUEST['_height'] ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['_tax_status'] ) )
|
if ( ! empty( $_REQUEST['_tax_status'] ) )
|
||||||
update_post_meta( $post_id, '_tax_status', woocommerce_clean( $_REQUEST['_tax_status'] ) );
|
update_post_meta( $post_id, '_tax_status', wc_clean( $_REQUEST['_tax_status'] ) );
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['_tax_class'] ) ) {
|
if ( ! empty( $_REQUEST['_tax_class'] ) ) {
|
||||||
$tax_class = woocommerce_clean( $_REQUEST['_tax_class'] );
|
$tax_class = wc_clean( $_REQUEST['_tax_class'] );
|
||||||
if ( $tax_class == 'standard' )
|
if ( $tax_class == 'standard' )
|
||||||
$tax_class = '';
|
$tax_class = '';
|
||||||
update_post_meta( $post_id, '_tax_class', $tax_class );
|
update_post_meta( $post_id, '_tax_class', $tax_class );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['_stock_status'] ) )
|
if ( ! empty( $_REQUEST['_stock_status'] ) )
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_REQUEST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_REQUEST['_stock_status'] ) );
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['_visibility'] ) )
|
if ( ! empty( $_REQUEST['_visibility'] ) )
|
||||||
update_post_meta( $post_id, '_visibility', stripslashes( $_REQUEST['_visibility'] ) );
|
update_post_meta( $post_id, '_visibility', stripslashes( $_REQUEST['_visibility'] ) );
|
||||||
|
@ -896,7 +896,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['_backorders'] ) ) {
|
if ( ! empty( $_REQUEST['_backorders'] ) ) {
|
||||||
update_post_meta( $post_id, '_backorders', woocommerce_clean( $_REQUEST['_backorders'] ) );
|
update_post_meta( $post_id, '_backorders', wc_clean( $_REQUEST['_backorders'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -998,7 +998,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
|
||||||
foreach ( $new_download_ids as $download_id ) {
|
foreach ( $new_download_ids as $download_id ) {
|
||||||
// grant permission if it doesn't already exist
|
// grant permission if it doesn't already exist
|
||||||
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1 FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $product_id, $download_id ) ) ) {
|
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1 FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $product_id, $download_id ) ) ) {
|
||||||
woocommerce_downloadable_file_permission( $download_id, $product_id, $order );
|
wc_downloadable_file_permission( $download_id, $product_id, $order );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ class WC_Admin_CPT_Shop_Coupon extends WC_Admin_CPT {
|
||||||
if ( $typenow == 'shop_coupon' && ! empty( $_GET['coupon_type'] ) ) {
|
if ( $typenow == 'shop_coupon' && ! empty( $_GET['coupon_type'] ) ) {
|
||||||
|
|
||||||
$vars['meta_key'] = 'discount_type';
|
$vars['meta_key'] = 'discount_type';
|
||||||
$vars['meta_value'] = woocommerce_clean( $_GET['coupon_type'] );
|
$vars['meta_value'] = wc_clean( $_GET['coupon_type'] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -517,7 +517,7 @@ class WC_Admin_CPT_Shop_Order extends WC_Admin_CPT {
|
||||||
if ( 'edit.php' != $pagenow || empty( $wp->query_vars['s'] ) || $wp->query_vars['post_type'] != 'shop_order' )
|
if ( 'edit.php' != $pagenow || empty( $wp->query_vars['s'] ) || $wp->query_vars['post_type'] != 'shop_order' )
|
||||||
return $wp;
|
return $wp;
|
||||||
|
|
||||||
$search_fields = array_map( 'woocommerce_clean', apply_filters( 'woocommerce_shop_order_search_fields', array(
|
$search_fields = array_map( 'wc_clean', apply_filters( 'woocommerce_shop_order_search_fields', array(
|
||||||
'_order_key',
|
'_order_key',
|
||||||
'_billing_first_name',
|
'_billing_first_name',
|
||||||
'_billing_last_name',
|
'_billing_last_name',
|
||||||
|
|
|
@ -224,18 +224,18 @@ class WC_Meta_Box_Coupon_Data {
|
||||||
WC_Admin_Meta_Boxes::add_error( __( 'Coupon code already exists - customers will use the latest coupon with this code.', 'woocommerce' ) );
|
WC_Admin_Meta_Boxes::add_error( __( 'Coupon code already exists - customers will use the latest coupon with this code.', 'woocommerce' ) );
|
||||||
|
|
||||||
// Add/Replace data to array
|
// Add/Replace data to array
|
||||||
$type = woocommerce_clean( $_POST['discount_type'] );
|
$type = wc_clean( $_POST['discount_type'] );
|
||||||
$amount = woocommerce_format_decimal( $_POST['coupon_amount'] );
|
$amount = wc_format_decimal( $_POST['coupon_amount'] );
|
||||||
$usage_limit = empty( $_POST['usage_limit'] ) ? '' : absint( $_POST['usage_limit'] );
|
$usage_limit = empty( $_POST['usage_limit'] ) ? '' : absint( $_POST['usage_limit'] );
|
||||||
$usage_limit_per_user = empty( $_POST['usage_limit_per_user'] ) ? '' : absint( $_POST['usage_limit_per_user'] );
|
$usage_limit_per_user = empty( $_POST['usage_limit_per_user'] ) ? '' : absint( $_POST['usage_limit_per_user'] );
|
||||||
$limit_usage_to_x_items = empty( $_POST['limit_usage_to_x_items'] ) ? '' : absint( $_POST['limit_usage_to_x_items'] );
|
$limit_usage_to_x_items = empty( $_POST['limit_usage_to_x_items'] ) ? '' : absint( $_POST['limit_usage_to_x_items'] );
|
||||||
$individual_use = isset( $_POST['individual_use'] ) ? 'yes' : 'no';
|
$individual_use = isset( $_POST['individual_use'] ) ? 'yes' : 'no';
|
||||||
$expiry_date = woocommerce_clean( $_POST['expiry_date'] );
|
$expiry_date = wc_clean( $_POST['expiry_date'] );
|
||||||
$apply_before_tax = isset( $_POST['apply_before_tax'] ) ? 'yes' : 'no';
|
$apply_before_tax = isset( $_POST['apply_before_tax'] ) ? 'yes' : 'no';
|
||||||
$free_shipping = isset( $_POST['free_shipping'] ) ? 'yes' : 'no';
|
$free_shipping = isset( $_POST['free_shipping'] ) ? 'yes' : 'no';
|
||||||
$exclude_sale_items = isset( $_POST['exclude_sale_items'] ) ? 'yes' : 'no';
|
$exclude_sale_items = isset( $_POST['exclude_sale_items'] ) ? 'yes' : 'no';
|
||||||
$minimum_amount = woocommerce_format_decimal( $_POST['minimum_amount'] );
|
$minimum_amount = wc_format_decimal( $_POST['minimum_amount'] );
|
||||||
$customer_email = array_filter( array_map( 'trim', explode( ',', woocommerce_clean( $_POST['customer_email'] ) ) ) );
|
$customer_email = array_filter( array_map( 'trim', explode( ',', wc_clean( $_POST['customer_email'] ) ) ) );
|
||||||
|
|
||||||
if ( isset( $_POST['product_ids'] ) ) {
|
if ( isset( $_POST['product_ids'] ) ) {
|
||||||
$product_ids = implode( ',', array_filter( array_map( 'intval', (array) $_POST['product_ids'] ) ) );
|
$product_ids = implode( ',', array_filter( array_map( 'intval', (array) $_POST['product_ids'] ) ) );
|
||||||
|
|
|
@ -87,7 +87,7 @@ class WC_Meta_Box_Order_Actions {
|
||||||
// Handle button actions
|
// Handle button actions
|
||||||
if ( ! empty( $_POST['wc_order_action'] ) ) {
|
if ( ! empty( $_POST['wc_order_action'] ) ) {
|
||||||
|
|
||||||
$action = woocommerce_clean( $_POST['wc_order_action'] );
|
$action = wc_clean( $_POST['wc_order_action'] );
|
||||||
|
|
||||||
if ( strstr( $action, 'send_email_' ) ) {
|
if ( strstr( $action, 'send_email_' ) ) {
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class WC_Meta_Box_Order_Actions {
|
||||||
} elseif ( $action == 'regenerate_download_permissions' ) {
|
} elseif ( $action == 'regenerate_download_permissions' ) {
|
||||||
|
|
||||||
delete_post_meta( $post_id, '_download_permissions_granted' );
|
delete_post_meta( $post_id, '_download_permissions_granted' );
|
||||||
woocommerce_downloadable_product_permissions( $post_id );
|
wc_downloadable_product_permissions( $post_id );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -358,17 +358,17 @@ class WC_Meta_Box_Order_Data {
|
||||||
|
|
||||||
if ( self::$billing_fields )
|
if ( self::$billing_fields )
|
||||||
foreach ( self::$shipping_fields as $key => $field )
|
foreach ( self::$shipping_fields as $key => $field )
|
||||||
update_post_meta( $post_id, '_billing_' . $key, woocommerce_clean( $_POST[ '_billing_' . $key ] ) );
|
update_post_meta( $post_id, '_billing_' . $key, wc_clean( $_POST[ '_billing_' . $key ] ) );
|
||||||
|
|
||||||
if ( self::$shipping_fields )
|
if ( self::$shipping_fields )
|
||||||
foreach ( self::$shipping_fields as $key => $field )
|
foreach ( self::$shipping_fields as $key => $field )
|
||||||
update_post_meta( $post_id, '_shipping_' . $key, woocommerce_clean( $_POST[ '_shipping_' . $key ] ) );
|
update_post_meta( $post_id, '_shipping_' . $key, wc_clean( $_POST[ '_shipping_' . $key ] ) );
|
||||||
|
|
||||||
// Payment method handling
|
// Payment method handling
|
||||||
if ( get_post_meta( $post_id, '_payment_method', true ) !== stripslashes( $_POST['_payment_method'] ) ) {
|
if ( get_post_meta( $post_id, '_payment_method', true ) !== stripslashes( $_POST['_payment_method'] ) ) {
|
||||||
|
|
||||||
$methods = WC()->payment_gateways->payment_gateways();
|
$methods = WC()->payment_gateways->payment_gateways();
|
||||||
$payment_method = woocommerce_clean( $_POST['_payment_method'] );
|
$payment_method = wc_clean( $_POST['_payment_method'] );
|
||||||
$payment_method_title = $payment_method;
|
$payment_method_title = $payment_method;
|
||||||
|
|
||||||
if ( isset( $methods) && isset( $methods[ $payment_method ] ) )
|
if ( isset( $methods) && isset( $methods[ $payment_method ] ) )
|
||||||
|
|
|
@ -212,8 +212,8 @@ class WC_Meta_Box_Order_Downloads {
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'user_id' => absint( $customer_user ),
|
'user_id' => absint( $customer_user ),
|
||||||
'user_email' => woocommerce_clean( $customer_email ),
|
'user_email' => wc_clean( $customer_email ),
|
||||||
'downloads_remaining' => woocommerce_clean( $downloads_remaining[ $i ] )
|
'downloads_remaining' => wc_clean( $downloads_remaining[ $i ] )
|
||||||
);
|
);
|
||||||
|
|
||||||
$format = array( '%d', '%s', '%s' );
|
$format = array( '%d', '%s', '%s' );
|
||||||
|
@ -230,7 +230,7 @@ class WC_Meta_Box_Order_Downloads {
|
||||||
array(
|
array(
|
||||||
'order_id' => $post_id,
|
'order_id' => $post_id,
|
||||||
'product_id' => absint( $product_ids[ $i ] ),
|
'product_id' => absint( $product_ids[ $i ] ),
|
||||||
'download_id' => woocommerce_clean( $download_ids[ $i ] )
|
'download_id' => wc_clean( $download_ids[ $i ] )
|
||||||
),
|
),
|
||||||
$format, array( '%d', '%d', '%s' )
|
$format, array( '%d', '%d', '%s' )
|
||||||
);
|
);
|
||||||
|
|
|
@ -125,40 +125,40 @@ class WC_Meta_Box_Order_Items {
|
||||||
if ( isset( $order_item_name[ $item_id ] ) )
|
if ( isset( $order_item_name[ $item_id ] ) )
|
||||||
$wpdb->update(
|
$wpdb->update(
|
||||||
$wpdb->prefix . "woocommerce_order_items",
|
$wpdb->prefix . "woocommerce_order_items",
|
||||||
array( 'order_item_name' => woocommerce_clean( $order_item_name[ $item_id ] ) ),
|
array( 'order_item_name' => wc_clean( $order_item_name[ $item_id ] ) ),
|
||||||
array( 'order_item_id' => $item_id ),
|
array( 'order_item_id' => $item_id ),
|
||||||
array( '%s' ),
|
array( '%s' ),
|
||||||
array( '%d' )
|
array( '%d' )
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( isset( $order_item_qty[ $item_id ] ) )
|
if ( isset( $order_item_qty[ $item_id ] ) )
|
||||||
woocommerce_update_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $order_item_qty[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $order_item_qty[ $item_id ] ) );
|
||||||
|
|
||||||
if ( isset( $order_item_tax_class[ $item_id ] ) )
|
if ( isset( $order_item_tax_class[ $item_id ] ) )
|
||||||
woocommerce_update_order_item_meta( $item_id, '_tax_class', woocommerce_clean( $order_item_tax_class[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, '_tax_class', wc_clean( $order_item_tax_class[ $item_id ] ) );
|
||||||
|
|
||||||
if ( isset( $line_subtotal[ $item_id ] ) ) {
|
if ( isset( $line_subtotal[ $item_id ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $item_id, '_line_subtotal', woocommerce_format_decimal( $line_subtotal[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, '_line_subtotal', wc_format_decimal( $line_subtotal[ $item_id ] ) );
|
||||||
|
|
||||||
$subtotal += woocommerce_format_decimal( $line_subtotal[ $item_id ] );
|
$subtotal += wc_format_decimal( $line_subtotal[ $item_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $line_subtotal_tax[ $item_id ] ) ) {
|
if ( isset( $line_subtotal_tax[ $item_id ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $item_id, '_line_subtotal_tax', woocommerce_format_decimal( $line_subtotal_tax[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, '_line_subtotal_tax', wc_format_decimal( $line_subtotal_tax[ $item_id ] ) );
|
||||||
|
|
||||||
$subtotal += woocommerce_format_decimal( $line_subtotal_tax[ $item_id ] );
|
$subtotal += wc_format_decimal( $line_subtotal_tax[ $item_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $line_total[ $item_id ] ) ) {
|
if ( isset( $line_total[ $item_id ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $item_id, '_line_total', woocommerce_format_decimal( $line_total[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, '_line_total', wc_format_decimal( $line_total[ $item_id ] ) );
|
||||||
|
|
||||||
$total += woocommerce_format_decimal( $line_total[ $item_id ] );
|
$total += wc_format_decimal( $line_total[ $item_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $line_tax[ $item_id ] ) ) {
|
if ( isset( $line_tax[ $item_id ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $item_id, '_line_tax', woocommerce_format_decimal( $line_tax[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, '_line_tax', wc_format_decimal( $line_tax[ $item_id ] ) );
|
||||||
|
|
||||||
$total += woocommerce_format_decimal( $line_tax[ $item_id ] );
|
$total += wc_format_decimal( $line_tax[ $item_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear meta cache
|
// Clear meta cache
|
||||||
|
|
|
@ -136,7 +136,7 @@ class WC_Meta_Box_Order_Totals {
|
||||||
|
|
||||||
$link = $post_id ? admin_url( 'post.php?post=' . $post_id . '&action=edit' ) : admin_url( 'edit.php?s=' . esc_url( $item['name'] ) . '&post_status=all&post_type=shop_coupon' );
|
$link = $post_id ? admin_url( 'post.php?post=' . $post_id . '&action=edit' ) : admin_url( 'edit.php?s=' . esc_url( $item['name'] ) . '&post_status=all&post_type=shop_coupon' );
|
||||||
|
|
||||||
echo '<li class="tips code" data-tip="' . esc_attr( woocommerce_price( $item['discount_amount'] ) ) . '"><a href="' . esc_url( $link ) . '"><span>' . esc_html( $item['name'] ). '</span></a></li>';
|
echo '<li class="tips code" data-tip="' . esc_attr( wc_price( $item['discount_amount'] ) ) . '"><a href="' . esc_url( $link ) . '"><span>' . esc_html( $item['name'] ). '</span></a></li>';
|
||||||
}
|
}
|
||||||
?></ul>
|
?></ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -194,27 +194,27 @@ class WC_Meta_Box_Order_Totals {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add line item
|
// Add line item
|
||||||
$new_id = woocommerce_add_order_item( $post_id, array(
|
$new_id = wc_add_order_item( $post_id, array(
|
||||||
'order_item_name' => woocommerce_clean( $code ),
|
'order_item_name' => wc_clean( $code ),
|
||||||
'order_item_type' => 'tax'
|
'order_item_type' => 'tax'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $new_id ) {
|
if ( $new_id ) {
|
||||||
woocommerce_update_order_item_meta( $new_id, 'rate_id', $rate_id );
|
wc_update_order_item_meta( $new_id, 'rate_id', $rate_id );
|
||||||
woocommerce_update_order_item_meta( $new_id, 'label', $label );
|
wc_update_order_item_meta( $new_id, 'label', $label );
|
||||||
woocommerce_update_order_item_meta( $new_id, 'compound', $compound );
|
wc_update_order_item_meta( $new_id, 'compound', $compound );
|
||||||
|
|
||||||
if ( isset( $order_taxes_amount[ $item_id ][ $new_key ] ) ) {
|
if ( isset( $order_taxes_amount[ $item_id ][ $new_key ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $new_id, 'tax_amount', woocommerce_format_decimal( $order_taxes_amount[ $item_id ][ $new_key ] ) );
|
wc_update_order_item_meta( $new_id, 'tax_amount', wc_format_decimal( $order_taxes_amount[ $item_id ][ $new_key ] ) );
|
||||||
|
|
||||||
$total_tax += woocommerce_format_decimal( $order_taxes_amount[ $item_id ][ $new_key ] );
|
$total_tax += wc_format_decimal( $order_taxes_amount[ $item_id ][ $new_key ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $order_taxes_shipping_amount[ $item_id ][ $new_key ] ) ) {
|
if ( isset( $order_taxes_shipping_amount[ $item_id ][ $new_key ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $new_id, 'shipping_tax_amount', woocommerce_format_decimal( $order_taxes_shipping_amount[ $item_id ][ $new_key ] ) );
|
wc_update_order_item_meta( $new_id, 'shipping_tax_amount', wc_format_decimal( $order_taxes_shipping_amount[ $item_id ][ $new_key ] ) );
|
||||||
|
|
||||||
$total_shipping_tax += woocommerce_format_decimal( $order_taxes_shipping_amount[ $item_id ][ $new_key ] );
|
$total_shipping_tax += wc_format_decimal( $order_taxes_shipping_amount[ $item_id ][ $new_key ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,36 +243,36 @@ class WC_Meta_Box_Order_Totals {
|
||||||
|
|
||||||
$wpdb->update(
|
$wpdb->update(
|
||||||
$wpdb->prefix . "woocommerce_order_items",
|
$wpdb->prefix . "woocommerce_order_items",
|
||||||
array( 'order_item_name' => woocommerce_clean( $code ) ),
|
array( 'order_item_name' => wc_clean( $code ) ),
|
||||||
array( 'order_item_id' => $item_id ),
|
array( 'order_item_id' => $item_id ),
|
||||||
array( '%s' ),
|
array( '%s' ),
|
||||||
array( '%d' )
|
array( '%d' )
|
||||||
);
|
);
|
||||||
|
|
||||||
woocommerce_update_order_item_meta( $item_id, 'rate_id', $rate_id );
|
wc_update_order_item_meta( $item_id, 'rate_id', $rate_id );
|
||||||
woocommerce_update_order_item_meta( $item_id, 'label', $label );
|
wc_update_order_item_meta( $item_id, 'label', $label );
|
||||||
woocommerce_update_order_item_meta( $item_id, 'compound', $compound );
|
wc_update_order_item_meta( $item_id, 'compound', $compound );
|
||||||
|
|
||||||
if ( isset( $order_taxes_amount[ $item_id ] ) ) {
|
if ( isset( $order_taxes_amount[ $item_id ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $item_id, 'tax_amount', woocommerce_format_decimal( $order_taxes_amount[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, 'tax_amount', wc_format_decimal( $order_taxes_amount[ $item_id ] ) );
|
||||||
|
|
||||||
$total_tax += woocommerce_format_decimal( $order_taxes_amount[ $item_id ] );
|
$total_tax += wc_format_decimal( $order_taxes_amount[ $item_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $order_taxes_shipping_amount[ $item_id ] ) ) {
|
if ( isset( $order_taxes_shipping_amount[ $item_id ] ) ) {
|
||||||
woocommerce_update_order_item_meta( $item_id, 'shipping_tax_amount', woocommerce_format_decimal( $order_taxes_shipping_amount[ $item_id ] ) );
|
wc_update_order_item_meta( $item_id, 'shipping_tax_amount', wc_format_decimal( $order_taxes_shipping_amount[ $item_id ] ) );
|
||||||
|
|
||||||
$total_shipping_tax += woocommerce_format_decimal( $order_taxes_shipping_amount[ $item_id ] );
|
$total_shipping_tax += wc_format_decimal( $order_taxes_shipping_amount[ $item_id ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update totals
|
// Update totals
|
||||||
update_post_meta( $post_id, '_order_tax', woocommerce_round_tax_total( $total_tax ) );
|
update_post_meta( $post_id, '_order_tax', wc_round_tax_total( $total_tax ) );
|
||||||
update_post_meta( $post_id, '_order_shipping_tax', woocommerce_round_tax_total( $total_shipping_tax ) );
|
update_post_meta( $post_id, '_order_shipping_tax', wc_round_tax_total( $total_shipping_tax ) );
|
||||||
update_post_meta( $post_id, '_order_discount', woocommerce_format_decimal( $_POST['_order_discount'] ) );
|
update_post_meta( $post_id, '_order_discount', wc_format_decimal( $_POST['_order_discount'] ) );
|
||||||
update_post_meta( $post_id, '_order_total', woocommerce_format_decimal( $_POST['_order_total'] ) );
|
update_post_meta( $post_id, '_order_total', wc_format_decimal( $_POST['_order_total'] ) );
|
||||||
|
|
||||||
// Shipping Rows
|
// Shipping Rows
|
||||||
$order_shipping = 0;
|
$order_shipping = 0;
|
||||||
|
@ -289,18 +289,18 @@ class WC_Meta_Box_Order_Totals {
|
||||||
if ( $item_id == 'new' ) {
|
if ( $item_id == 'new' ) {
|
||||||
|
|
||||||
foreach ( $value as $new_key => $new_value ) {
|
foreach ( $value as $new_key => $new_value ) {
|
||||||
$method_id = woocommerce_clean( $shipping_method[ $item_id ][ $new_key ] );
|
$method_id = wc_clean( $shipping_method[ $item_id ][ $new_key ] );
|
||||||
$method_title = woocommerce_clean( $shipping_method_title[ $item_id ][ $new_key ] );
|
$method_title = wc_clean( $shipping_method_title[ $item_id ][ $new_key ] );
|
||||||
$cost = woocommerce_format_decimal( $shipping_cost[ $item_id ][ $new_key ] );
|
$cost = wc_format_decimal( $shipping_cost[ $item_id ][ $new_key ] );
|
||||||
|
|
||||||
$new_id = woocommerce_add_order_item( $post_id, array(
|
$new_id = wc_add_order_item( $post_id, array(
|
||||||
'order_item_name' => $method_title,
|
'order_item_name' => $method_title,
|
||||||
'order_item_type' => 'shipping'
|
'order_item_type' => 'shipping'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( $new_id ) {
|
if ( $new_id ) {
|
||||||
woocommerce_add_order_item_meta( $new_id, 'method_id', $method_id );
|
wc_add_order_item_meta( $new_id, 'method_id', $method_id );
|
||||||
woocommerce_add_order_item_meta( $new_id, 'cost', $cost );
|
wc_add_order_item_meta( $new_id, 'cost', $cost );
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_shipping += $cost;
|
$order_shipping += $cost;
|
||||||
|
@ -309,9 +309,9 @@ class WC_Meta_Box_Order_Totals {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$item_id = absint( $item_id );
|
$item_id = absint( $item_id );
|
||||||
$method_id = woocommerce_clean( $shipping_method[ $item_id ] );
|
$method_id = wc_clean( $shipping_method[ $item_id ] );
|
||||||
$method_title = woocommerce_clean( $shipping_method_title[ $item_id ] );
|
$method_title = wc_clean( $shipping_method_title[ $item_id ] );
|
||||||
$cost = woocommerce_format_decimal( $shipping_cost[ $item_id ] );
|
$cost = wc_format_decimal( $shipping_cost[ $item_id ] );
|
||||||
|
|
||||||
$wpdb->update(
|
$wpdb->update(
|
||||||
$wpdb->prefix . "woocommerce_order_items",
|
$wpdb->prefix . "woocommerce_order_items",
|
||||||
|
@ -321,8 +321,8 @@ class WC_Meta_Box_Order_Totals {
|
||||||
array( '%d' )
|
array( '%d' )
|
||||||
);
|
);
|
||||||
|
|
||||||
woocommerce_update_order_item_meta( $item_id, 'method_id', $method_id );
|
wc_update_order_item_meta( $item_id, 'method_id', $method_id );
|
||||||
woocommerce_update_order_item_meta( $item_id, 'cost', $cost );
|
wc_update_order_item_meta( $item_id, 'cost', $cost );
|
||||||
|
|
||||||
$order_shipping += $cost;
|
$order_shipping += $cost;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ class WC_Meta_Box_Order_Totals {
|
||||||
$delete_ids = $_POST['delete_order_item_id'];
|
$delete_ids = $_POST['delete_order_item_id'];
|
||||||
|
|
||||||
foreach ( $delete_ids as $id )
|
foreach ( $delete_ids as $id )
|
||||||
woocommerce_delete_order_item( absint( $id ) );
|
wc_delete_order_item( absint( $id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_post_meta( $post_id, '_shipping_method' );
|
delete_post_meta( $post_id, '_shipping_method' );
|
||||||
|
|
|
@ -932,9 +932,9 @@ class WC_Meta_Box_Product_Data {
|
||||||
|
|
||||||
// Update post meta
|
// Update post meta
|
||||||
if ( isset( $_POST['_regular_price'] ) )
|
if ( isset( $_POST['_regular_price'] ) )
|
||||||
update_post_meta( $post_id, '_regular_price', ( $_POST['_regular_price'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_regular_price'] ) );
|
update_post_meta( $post_id, '_regular_price', ( $_POST['_regular_price'] === '' ) ? '' : wc_format_decimal( $_POST['_regular_price'] ) );
|
||||||
if ( isset( $_POST['_sale_price'] ) )
|
if ( isset( $_POST['_sale_price'] ) )
|
||||||
update_post_meta( $post_id, '_sale_price', ( $_POST['_sale_price'] === '' ? '' : woocommerce_format_decimal( $_POST['_sale_price'] ) ) );
|
update_post_meta( $post_id, '_sale_price', ( $_POST['_sale_price'] === '' ? '' : wc_format_decimal( $_POST['_sale_price'] ) ) );
|
||||||
if ( isset( $_POST['_tax_status'] ) ) update_post_meta( $post_id, '_tax_status', stripslashes( $_POST['_tax_status'] ) );
|
if ( isset( $_POST['_tax_status'] ) ) update_post_meta( $post_id, '_tax_status', stripslashes( $_POST['_tax_status'] ) );
|
||||||
if ( isset( $_POST['_tax_class'] ) ) update_post_meta( $post_id, '_tax_class', stripslashes( $_POST['_tax_class'] ) );
|
if ( isset( $_POST['_tax_class'] ) ) update_post_meta( $post_id, '_tax_class', stripslashes( $_POST['_tax_class'] ) );
|
||||||
if ( isset( $_POST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
|
if ( isset( $_POST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
|
||||||
|
@ -945,16 +945,16 @@ class WC_Meta_Box_Product_Data {
|
||||||
if ( $is_virtual == 'no' ) {
|
if ( $is_virtual == 'no' ) {
|
||||||
|
|
||||||
if ( isset( $_POST['_weight'] ) )
|
if ( isset( $_POST['_weight'] ) )
|
||||||
update_post_meta( $post_id, '_weight', ( $_POST['_weight'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_weight'] ) );
|
update_post_meta( $post_id, '_weight', ( $_POST['_weight'] === '' ) ? '' : wc_format_decimal( $_POST['_weight'] ) );
|
||||||
|
|
||||||
if ( isset( $_POST['_length'] ) )
|
if ( isset( $_POST['_length'] ) )
|
||||||
update_post_meta( $post_id, '_length', ( $_POST['_length'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_length'] ) );
|
update_post_meta( $post_id, '_length', ( $_POST['_length'] === '' ) ? '' : wc_format_decimal( $_POST['_length'] ) );
|
||||||
|
|
||||||
if ( isset( $_POST['_width'] ) )
|
if ( isset( $_POST['_width'] ) )
|
||||||
update_post_meta( $post_id, '_width', ( $_POST['_width'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_width'] ) );
|
update_post_meta( $post_id, '_width', ( $_POST['_width'] === '' ) ? '' : wc_format_decimal( $_POST['_width'] ) );
|
||||||
|
|
||||||
if ( isset( $_POST['_height'] ) )
|
if ( isset( $_POST['_height'] ) )
|
||||||
update_post_meta( $post_id, '_height', ( $_POST['_height'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_height'] ) );
|
update_post_meta( $post_id, '_height', ( $_POST['_height'] === '' ) ? '' : wc_format_decimal( $_POST['_height'] ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
update_post_meta( $post_id, '_weight', '' );
|
update_post_meta( $post_id, '_weight', '' );
|
||||||
|
@ -969,7 +969,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
|
|
||||||
// Unique SKU
|
// Unique SKU
|
||||||
$sku = get_post_meta( $post_id, '_sku', true );
|
$sku = get_post_meta( $post_id, '_sku', true );
|
||||||
$new_sku = woocommerce_clean( stripslashes( $_POST['_sku'] ) );
|
$new_sku = wc_clean( stripslashes( $_POST['_sku'] ) );
|
||||||
|
|
||||||
if ( $new_sku == '' ) {
|
if ( $new_sku == '' ) {
|
||||||
update_post_meta( $post_id, '_sku', '' );
|
update_post_meta( $post_id, '_sku', '' );
|
||||||
|
@ -1049,7 +1049,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
if ( $values ) {
|
if ( $values ) {
|
||||||
// Add attribute to array, but don't set values
|
// Add attribute to array, but don't set values
|
||||||
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
||||||
'name' => woocommerce_clean( $attribute_names[ $i ] ),
|
'name' => wc_clean( $attribute_names[ $i ] ),
|
||||||
'value' => '',
|
'value' => '',
|
||||||
'position' => $attribute_position[ $i ],
|
'position' => $attribute_position[ $i ],
|
||||||
'is_visible' => $is_visible,
|
'is_visible' => $is_visible,
|
||||||
|
@ -1061,11 +1061,11 @@ class WC_Meta_Box_Product_Data {
|
||||||
} elseif ( isset( $attribute_values[ $i ] ) ) {
|
} elseif ( isset( $attribute_values[ $i ] ) ) {
|
||||||
|
|
||||||
// Text based, separate by pipe
|
// Text based, separate by pipe
|
||||||
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'woocommerce_clean', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) );
|
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) );
|
||||||
|
|
||||||
// Custom attribute - Add attribute to array and set the values
|
// Custom attribute - Add attribute to array and set the values
|
||||||
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
||||||
'name' => woocommerce_clean( $attribute_names[ $i ] ),
|
'name' => wc_clean( $attribute_names[ $i ] ),
|
||||||
'value' => $values,
|
'value' => $values,
|
||||||
'position' => $attribute_position[ $i ],
|
'position' => $attribute_position[ $i ],
|
||||||
'is_visible' => $is_visible,
|
'is_visible' => $is_visible,
|
||||||
|
@ -1118,15 +1118,15 @@ class WC_Meta_Box_Product_Data {
|
||||||
|
|
||||||
// Update price if on sale
|
// Update price if on sale
|
||||||
if ( $_POST['_sale_price'] !== '' && $date_to == '' && $date_from == '' )
|
if ( $_POST['_sale_price'] !== '' && $date_to == '' && $date_from == '' )
|
||||||
update_post_meta( $post_id, '_price', woocommerce_format_decimal( $_POST['_sale_price'] ) );
|
update_post_meta( $post_id, '_price', wc_format_decimal( $_POST['_sale_price'] ) );
|
||||||
else
|
else
|
||||||
update_post_meta( $post_id, '_price', ( $_POST['_regular_price'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_regular_price'] ) );
|
update_post_meta( $post_id, '_price', ( $_POST['_regular_price'] === '' ) ? '' : wc_format_decimal( $_POST['_regular_price'] ) );
|
||||||
|
|
||||||
if ( $_POST['_sale_price'] !== '' && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) )
|
if ( $_POST['_sale_price'] !== '' && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) )
|
||||||
update_post_meta( $post_id, '_price', woocommerce_format_decimal( $_POST['_sale_price'] ) );
|
update_post_meta( $post_id, '_price', wc_format_decimal( $_POST['_sale_price'] ) );
|
||||||
|
|
||||||
if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
|
if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
|
||||||
update_post_meta( $post_id, '_price', ( $_POST['_regular_price'] === '' ) ? '' : woocommerce_format_decimal( $_POST['_regular_price'] ) );
|
update_post_meta( $post_id, '_price', ( $_POST['_regular_price'] === '' ) ? '' : wc_format_decimal( $_POST['_regular_price'] ) );
|
||||||
update_post_meta( $post_id, '_sale_price_dates_from', '' );
|
update_post_meta( $post_id, '_sale_price_dates_from', '' );
|
||||||
update_post_meta( $post_id, '_sale_price_dates_to', '' );
|
update_post_meta( $post_id, '_sale_price_dates_to', '' );
|
||||||
}
|
}
|
||||||
|
@ -1188,7 +1188,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
update_post_meta( $post_id, '_backorders', 'no' );
|
update_post_meta( $post_id, '_backorders', 'no' );
|
||||||
update_post_meta( $post_id, '_stock', '' );
|
update_post_meta( $post_id, '_stock', '' );
|
||||||
|
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_POST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
|
||||||
|
|
||||||
} elseif ( $product_type == 'external' ) {
|
} elseif ( $product_type == 'external' ) {
|
||||||
|
|
||||||
|
@ -1201,23 +1201,23 @@ class WC_Meta_Box_Product_Data {
|
||||||
} elseif ( ! empty( $_POST['_manage_stock'] ) ) {
|
} elseif ( ! empty( $_POST['_manage_stock'] ) ) {
|
||||||
|
|
||||||
update_post_meta( $post_id, '_manage_stock', 'yes' );
|
update_post_meta( $post_id, '_manage_stock', 'yes' );
|
||||||
update_post_meta( $post_id, '_backorders', woocommerce_clean( $_POST['_backorders'] ) );
|
update_post_meta( $post_id, '_backorders', wc_clean( $_POST['_backorders'] ) );
|
||||||
|
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_POST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
|
||||||
wc_update_product_stock( $post_id, intval( $_POST['_stock'] ) );
|
wc_update_product_stock( $post_id, intval( $_POST['_stock'] ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Don't manage stock
|
// Don't manage stock
|
||||||
update_post_meta( $post_id, '_manage_stock', 'no' );
|
update_post_meta( $post_id, '_manage_stock', 'no' );
|
||||||
update_post_meta( $post_id, '_backorders', woocommerce_clean( $_POST['_backorders'] ) );
|
update_post_meta( $post_id, '_backorders', wc_clean( $_POST['_backorders'] ) );
|
||||||
update_post_meta( $post_id, '_stock', '' );
|
update_post_meta( $post_id, '_stock', '' );
|
||||||
|
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_POST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wc_update_product_stock_status( $post_id, woocommerce_clean( $_POST['_stock_status'] ) );
|
wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upsells
|
// Upsells
|
||||||
|
@ -1261,7 +1261,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
if ( isset( $_POST['_wc_file_urls'] ) ) {
|
if ( isset( $_POST['_wc_file_urls'] ) ) {
|
||||||
$files = array();
|
$files = array();
|
||||||
|
|
||||||
$file_names = isset( $_POST['_wc_file_names'] ) ? array_map( 'woocommerce_clean', $_POST['_wc_file_names'] ) : array();
|
$file_names = isset( $_POST['_wc_file_names'] ) ? array_map( 'wc_clean', $_POST['_wc_file_names'] ) : array();
|
||||||
$file_urls = isset( $_POST['_wc_file_urls'] ) ? array_map( 'esc_url_raw', array_map( 'trim', $_POST['_wc_file_urls'] ) ) : array();
|
$file_urls = isset( $_POST['_wc_file_urls'] ) ? array_map( 'esc_url_raw', array_map( 'trim', $_POST['_wc_file_urls'] ) ) : array();
|
||||||
$file_url_size = sizeof( $file_urls );
|
$file_url_size = sizeof( $file_urls );
|
||||||
|
|
||||||
|
@ -1283,7 +1283,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
update_post_meta( $post_id, '_download_expiry', $_download_expiry );
|
update_post_meta( $post_id, '_download_expiry', $_download_expiry );
|
||||||
|
|
||||||
if ( isset( $_POST['_download_type'] ) )
|
if ( isset( $_POST['_download_type'] ) )
|
||||||
update_post_meta( $post_id, '_download_type', woocommerce_clean( $_POST['_download_type'] ) );
|
update_post_meta( $post_id, '_download_type', wc_clean( $_POST['_download_type'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Product url
|
// Product url
|
||||||
|
@ -1382,29 +1382,29 @@ class WC_Meta_Box_Product_Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update post meta
|
// Update post meta
|
||||||
update_post_meta( $variation_id, '_sku', woocommerce_clean( $variable_sku[ $i ] ) );
|
update_post_meta( $variation_id, '_sku', wc_clean( $variable_sku[ $i ] ) );
|
||||||
update_post_meta( $variation_id, '_thumbnail_id', absint( $upload_image_id[ $i ] ) );
|
update_post_meta( $variation_id, '_thumbnail_id', absint( $upload_image_id[ $i ] ) );
|
||||||
update_post_meta( $variation_id, '_virtual', woocommerce_clean( $is_virtual ) );
|
update_post_meta( $variation_id, '_virtual', wc_clean( $is_virtual ) );
|
||||||
update_post_meta( $variation_id, '_downloadable', woocommerce_clean( $is_downloadable ) );
|
update_post_meta( $variation_id, '_downloadable', wc_clean( $is_downloadable ) );
|
||||||
|
|
||||||
if ( isset( $variable_weight[ $i ] ) )
|
if ( isset( $variable_weight[ $i ] ) )
|
||||||
update_post_meta( $variation_id, '_weight', ( $variable_weight[ $i ] === '' ) ? '' : woocommerce_format_decimal( $variable_weight[ $i ] ) );
|
update_post_meta( $variation_id, '_weight', ( $variable_weight[ $i ] === '' ) ? '' : wc_format_decimal( $variable_weight[ $i ] ) );
|
||||||
if ( isset( $variable_length[ $i ] ) )
|
if ( isset( $variable_length[ $i ] ) )
|
||||||
update_post_meta( $variation_id, '_length', ( $variable_length[ $i ] === '' ) ? '' : woocommerce_format_decimal( $variable_length[ $i ] ) );
|
update_post_meta( $variation_id, '_length', ( $variable_length[ $i ] === '' ) ? '' : wc_format_decimal( $variable_length[ $i ] ) );
|
||||||
if ( isset( $variable_width[ $i ] ) )
|
if ( isset( $variable_width[ $i ] ) )
|
||||||
update_post_meta( $variation_id, '_width', ( $variable_width[ $i ] === '' ) ? '' : woocommerce_format_decimal( $variable_width[ $i ] ) );
|
update_post_meta( $variation_id, '_width', ( $variable_width[ $i ] === '' ) ? '' : wc_format_decimal( $variable_width[ $i ] ) );
|
||||||
if ( isset( $variable_height[ $i ] ) )
|
if ( isset( $variable_height[ $i ] ) )
|
||||||
update_post_meta( $variation_id, '_height', ( $variable_height[ $i ] === '' ) ? '' : woocommerce_format_decimal( $variable_height[ $i ] ) );
|
update_post_meta( $variation_id, '_height', ( $variable_height[ $i ] === '' ) ? '' : wc_format_decimal( $variable_height[ $i ] ) );
|
||||||
|
|
||||||
// Stock handling
|
// Stock handling
|
||||||
if ( isset($variable_stock[$i]) )
|
if ( isset($variable_stock[$i]) )
|
||||||
wc_update_product_stock( $variation_id, woocommerce_clean( $variable_stock[ $i ] ) );
|
wc_update_product_stock( $variation_id, wc_clean( $variable_stock[ $i ] ) );
|
||||||
|
|
||||||
// Price handling
|
// Price handling
|
||||||
$regular_price = woocommerce_format_decimal( $variable_regular_price[ $i ] );
|
$regular_price = wc_format_decimal( $variable_regular_price[ $i ] );
|
||||||
$sale_price = ( $variable_sale_price[ $i ] === '' ? '' : woocommerce_format_decimal( $variable_sale_price[ $i ] ) );
|
$sale_price = ( $variable_sale_price[ $i ] === '' ? '' : wc_format_decimal( $variable_sale_price[ $i ] ) );
|
||||||
$date_from = woocommerce_clean( $variable_sale_price_dates_from[ $i ] );
|
$date_from = wc_clean( $variable_sale_price_dates_from[ $i ] );
|
||||||
$date_to = woocommerce_clean( $variable_sale_price_dates_to[ $i ] );
|
$date_to = wc_clean( $variable_sale_price_dates_to[ $i ] );
|
||||||
|
|
||||||
update_post_meta( $variation_id, '_regular_price', $regular_price );
|
update_post_meta( $variation_id, '_regular_price', $regular_price );
|
||||||
update_post_meta( $variation_id, '_sale_price', $sale_price );
|
update_post_meta( $variation_id, '_sale_price', $sale_price );
|
||||||
|
@ -1439,16 +1439,16 @@ class WC_Meta_Box_Product_Data {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $variable_tax_class[ $i ] ) && $variable_tax_class[ $i ] !== 'parent' )
|
if ( isset( $variable_tax_class[ $i ] ) && $variable_tax_class[ $i ] !== 'parent' )
|
||||||
update_post_meta( $variation_id, '_tax_class', woocommerce_clean( $variable_tax_class[ $i ] ) );
|
update_post_meta( $variation_id, '_tax_class', wc_clean( $variable_tax_class[ $i ] ) );
|
||||||
else
|
else
|
||||||
delete_post_meta( $variation_id, '_tax_class' );
|
delete_post_meta( $variation_id, '_tax_class' );
|
||||||
|
|
||||||
if ( $is_downloadable == 'yes' ) {
|
if ( $is_downloadable == 'yes' ) {
|
||||||
update_post_meta( $variation_id, '_download_limit', woocommerce_clean( $variable_download_limit[ $i ] ) );
|
update_post_meta( $variation_id, '_download_limit', wc_clean( $variable_download_limit[ $i ] ) );
|
||||||
update_post_meta( $variation_id, '_download_expiry', woocommerce_clean( $variable_download_expiry[ $i ] ) );
|
update_post_meta( $variation_id, '_download_expiry', wc_clean( $variable_download_expiry[ $i ] ) );
|
||||||
|
|
||||||
$files = array();
|
$files = array();
|
||||||
$file_names = isset( $_POST['_wc_variation_file_names'][ $variation_id ] ) ? array_map( 'woocommerce_clean', $_POST['_wc_variation_file_names'][ $variation_id ] ) : array();
|
$file_names = isset( $_POST['_wc_variation_file_names'][ $variation_id ] ) ? array_map( 'wc_clean', $_POST['_wc_variation_file_names'][ $variation_id ] ) : array();
|
||||||
$file_urls = isset( $_POST['_wc_variation_file_urls'][ $variation_id ] ) ? array_map( 'esc_url_raw', array_map( 'trim', $_POST['_wc_variation_file_urls'][ $variation_id ] ) ) : array();
|
$file_urls = isset( $_POST['_wc_variation_file_urls'][ $variation_id ] ) ? array_map( 'esc_url_raw', array_map( 'trim', $_POST['_wc_variation_file_urls'][ $variation_id ] ) ) : array();
|
||||||
$file_url_size = sizeof( $file_urls );
|
$file_url_size = sizeof( $file_urls );
|
||||||
|
|
||||||
|
@ -1484,7 +1484,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
foreach ( $attributes as $attribute ) {
|
foreach ( $attributes as $attribute ) {
|
||||||
|
|
||||||
if ( $attribute['is_variation'] ) {
|
if ( $attribute['is_variation'] ) {
|
||||||
// Don't use woocommerce_clean as it destroys sanitized characters
|
// Don't use wc_clean as it destroys sanitized characters
|
||||||
if ( isset( $_POST[ 'attribute_' . sanitize_title( $attribute['name'] ) ][ $i ] ) )
|
if ( isset( $_POST[ 'attribute_' . sanitize_title( $attribute['name'] ) ][ $i ] ) )
|
||||||
$value = sanitize_title( trim( stripslashes( $_POST[ 'attribute_' . sanitize_title( $attribute['name'] ) ][ $i ] ) ) );
|
$value = sanitize_title( trim( stripslashes( $_POST[ 'attribute_' . sanitize_title( $attribute['name'] ) ][ $i ] ) ) );
|
||||||
else
|
else
|
||||||
|
@ -1508,7 +1508,7 @@ class WC_Meta_Box_Product_Data {
|
||||||
foreach ( $attributes as $attribute ) {
|
foreach ( $attributes as $attribute ) {
|
||||||
if ( $attribute['is_variation'] ) {
|
if ( $attribute['is_variation'] ) {
|
||||||
|
|
||||||
// Don't use woocommerce_clean as it destroys sanitized characters
|
// Don't use wc_clean as it destroys sanitized characters
|
||||||
if ( isset( $_POST[ 'default_attribute_' . sanitize_title( $attribute['name'] ) ] ) )
|
if ( isset( $_POST[ 'default_attribute_' . sanitize_title( $attribute['name'] ) ] ) )
|
||||||
$value = sanitize_title( trim( stripslashes( $_POST[ 'default_attribute_' . sanitize_title( $attribute['name'] ) ] ) ) );
|
$value = sanitize_title( trim( stripslashes( $_POST[ 'default_attribute_' . sanitize_title( $attribute['name'] ) ] ) ) );
|
||||||
else
|
else
|
||||||
|
|
|
@ -169,7 +169,7 @@ class WC_Meta_Box_Product_Images {
|
||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
$attachment_ids = array_filter( explode( ',', woocommerce_clean( $_POST['product_image_gallery'] ) ) );
|
$attachment_ids = array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) );
|
||||||
|
|
||||||
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
|
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
<button type="button" rel="<?php echo absint( $download->product_id ) . ',' . esc_attr( $download->download_id ); ?>" class="revoke_access button"><?php _e( 'Revoke Access', 'woocommerce' ); ?></button>
|
<button type="button" rel="<?php echo absint( $download->product_id ) . ',' . esc_attr( $download->download_id ); ?>" class="revoke_access button"><?php _e( 'Revoke Access', 'woocommerce' ); ?></button>
|
||||||
<div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div>
|
<div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div>
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo '#' . absint( $product->id ) . ' — ' . apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_title(), $download->product_id, $download->order_id, $download->order_key, $download->download_id ) . ' — ' . sprintf( __( 'File %d: %s', 'woocommerce' ), $file_count, woocommerce_get_filename_from_url( $product->get_file_download_path( $download->download_id ) ) ) . ' — ' . sprintf( _n('Downloaded %s time', 'Downloaded %s times', absint( $download->download_count ), 'woocommerce'), absint( $download->download_count ) ); ?>
|
<?php echo '#' . absint( $product->id ) . ' — ' . apply_filters( 'woocommerce_admin_download_permissions_title', $product->get_title(), $download->product_id, $download->order_id, $download->order_key, $download->download_id ) . ' — ' . sprintf( __( 'File %d: %s', 'woocommerce' ), $file_count, wc_get_filename_from_url( $product->get_file_download_path( $download->download_id ) ) ) . ' — ' . sprintf( _n('Downloaded %s time', 'Downloaded %s times', absint( $download->download_count ), 'woocommerce'), absint( $download->download_count ) ); ?>
|
||||||
</strong>
|
</strong>
|
||||||
</h3>
|
</h3>
|
||||||
<table cellpadding="0" cellspacing="0" class="wc-metabox-content">
|
<table cellpadding="0" cellspacing="0" class="wc-metabox-content">
|
||||||
|
|
|
@ -56,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
<td class="line_cost" width="1%">
|
<td class="line_cost" width="1%">
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php if ( isset( $item['line_total'] ) ) echo woocommerce_price( woocommerce_round_tax_total( $item['line_tax'] ) ); ?>
|
<?php if ( isset( $item['line_total'] ) ) echo wc_price( wc_round_tax_total( $item['line_tax'] ) ); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="edit" style="display:none">
|
<div class="edit" style="display:none">
|
||||||
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php if ( isset( $item['line_total'] ) ) echo esc_attr( wc_format_localized_price( $item['line_total'] ) ); ?>" class="line_total wc_input_price" /></label>
|
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php if ( isset( $item['line_total'] ) ) echo esc_attr( wc_format_localized_price( $item['line_total'] ) ); ?>" class="line_total wc_input_price" /></label>
|
||||||
|
@ -67,7 +67,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
<td class="line_tax" width="1%">
|
<td class="line_tax" width="1%">
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php if ( isset( $item['line_tax'] ) ) echo woocommerce_price( woocommerce_round_tax_total( $item['line_tax'] ) ); ?>
|
<?php if ( isset( $item['line_tax'] ) ) echo wc_price( wc_round_tax_total( $item['line_tax'] ) ); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="edit" style="display:none">
|
<div class="edit" style="display:none">
|
||||||
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php if ( isset( $item['line_tax'] ) ) echo esc_attr( wc_format_localized_price( $item['line_tax'] ) ); ?>" class="line_tax wc_input_price" />
|
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php if ( isset( $item['line_tax'] ) ) echo esc_attr( wc_format_localized_price( $item['line_tax'] ) ); ?>" class="line_tax wc_input_price" />
|
||||||
|
|
|
@ -159,9 +159,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $item['line_total'] ) ) {
|
if ( isset( $item['line_total'] ) ) {
|
||||||
if ( isset( $item['line_subtotal'] ) && $item['line_subtotal'] != $item['line_total'] ) echo '<del>' . woocommerce_price( $item['line_subtotal'] ) . '</del> ';
|
if ( isset( $item['line_subtotal'] ) && $item['line_subtotal'] != $item['line_total'] ) echo '<del>' . wc_price( $item['line_subtotal'] ) . '</del> ';
|
||||||
|
|
||||||
echo woocommerce_price( $item['line_total'] );
|
echo wc_price( $item['line_total'] );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -178,9 +178,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $item['line_tax'] ) ) {
|
if ( isset( $item['line_tax'] ) ) {
|
||||||
if ( isset( $item['line_subtotal_tax'] ) && $item['line_subtotal_tax'] != $item['line_tax'] ) echo '<del>' . woocommerce_price( woocommerce_round_tax_total( $item['line_subtotal_tax'] ) ) . '</del> ';
|
if ( isset( $item['line_subtotal_tax'] ) && $item['line_subtotal_tax'] != $item['line_tax'] ) echo '<del>' . wc_price( wc_round_tax_total( $item['line_subtotal_tax'] ) ) . '</del> ';
|
||||||
|
|
||||||
echo woocommerce_price( woocommerce_round_tax_total( $item['line_tax'] ) );
|
echo wc_price( wc_round_tax_total( $item['line_tax'] ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -386,7 +386,7 @@ class WC_Admin_Report {
|
||||||
$total += $d->sparkline_value;
|
$total += $d->sparkline_value;
|
||||||
|
|
||||||
if ( $type == 'sales' ) {
|
if ( $type == 'sales' ) {
|
||||||
$tooltip = sprintf( __( 'Sold %s worth in the last %d days', 'woocommerce' ), strip_tags( woocommerce_price( $total ) ), $days );
|
$tooltip = sprintf( __( 'Sold %s worth in the last %d days', 'woocommerce' ), strip_tags( wc_price( $total ) ), $days );
|
||||||
} else {
|
} else {
|
||||||
$tooltip = sprintf( _n( 'Sold 1 item in the last %d days', 'Sold %d items in the last %d days', $total, 'woocommerce' ), $total, $days );
|
$tooltip = sprintf( _n( 'Sold 1 item in the last %d days', 'Sold %d items in the last %d days', $total, 'woocommerce' ), $total, $days );
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
'title' => sprintf( __( '%s discounts in total', 'woocommerce' ), '<strong>' . woocommerce_price( $total_discount ) . '</strong>' ),
|
'title' => sprintf( __( '%s discounts in total', 'woocommerce' ), '<strong>' . wc_price( $total_discount ) . '</strong>' ),
|
||||||
'color' => $this->chart_colours['discount_amount'],
|
'color' => $this->chart_colours['discount_amount'],
|
||||||
'highlight_series' => 1
|
'highlight_series' => 1
|
||||||
);
|
);
|
||||||
|
@ -265,7 +265,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
||||||
if ( $most_discount ) {
|
if ( $most_discount ) {
|
||||||
foreach ( $most_discount as $coupon ) {
|
foreach ( $most_discount as $coupon ) {
|
||||||
echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '">
|
echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '">
|
||||||
<td class="count" width="1%">' . woocommerce_price( $coupon->discount_amount ) . '</td>
|
<td class="count" width="1%">' . wc_price( $coupon->discount_amount ) . '</td>
|
||||||
<td class="name"><a href="' . add_query_arg( 'coupon_codes', $coupon->coupon_code ) . '">' . $coupon->coupon_code . '</a></td>
|
<td class="name"><a href="' . add_query_arg( 'coupon_codes', $coupon->coupon_code ) . '">' . $coupon->coupon_code . '</a></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class WC_Report_Customer_List extends WP_List_Table {
|
||||||
echo '<div id="poststuff" class="woocommerce-reports-wide">';
|
echo '<div id="poststuff" class="woocommerce-reports-wide">';
|
||||||
|
|
||||||
if ( ! empty( $_GET['link_orders'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'link_orders' ) ) {
|
if ( ! empty( $_GET['link_orders'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'link_orders' ) ) {
|
||||||
$linked = woocommerce_update_new_customer_past_orders( absint( $_GET['link_orders'] ) );
|
$linked = wc_update_new_customer_past_orders( absint( $_GET['link_orders'] ) );
|
||||||
|
|
||||||
echo '<div class="updated"><p>' . sprintf( _n( '%s previous order linked', '%s previous orders linked', $linked, 'woocommerce' ), $linked ) . '</p></div>';
|
echo '<div class="updated"><p>' . sprintf( _n( '%s previous order linked', '%s previous orders linked', $linked, 'woocommerce' ), $linked ) . '</p></div>';
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class WC_Report_Customer_List extends WP_List_Table {
|
||||||
update_user_meta( $user->ID, '_money_spent', $spent );
|
update_user_meta( $user->ID, '_money_spent', $spent );
|
||||||
}
|
}
|
||||||
|
|
||||||
return woocommerce_price( $spent );
|
return wc_price( $spent );
|
||||||
break;
|
break;
|
||||||
case 'orders' :
|
case 'orders' :
|
||||||
if ( ! $count = get_user_meta( $user->ID, '_order_count', true ) ) {
|
if ( ! $count = get_user_meta( $user->ID, '_order_count', true ) ) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
||||||
// continue;
|
// continue;
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
'title' => sprintf( __( '%s sales in %s', 'woocommerce' ), '<strong>' . woocommerce_price( $total ) . '</strong>', $category->name ),
|
'title' => sprintf( __( '%s sales in %s', 'woocommerce' ), '<strong>' . wc_price( $total ) . '</strong>', $category->name ),
|
||||||
'color' => isset( $this->chart_colours[ $index ] ) ? $this->chart_colours[ $index ] : $this->chart_colours[ 0 ],
|
'color' => isset( $this->chart_colours[ $index ] ) ? $this->chart_colours[ $index ] : $this->chart_colours[ 0 ],
|
||||||
'highlight_series' => $index
|
'highlight_series' => $index
|
||||||
);
|
);
|
||||||
|
|
|
@ -71,15 +71,15 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
|
|
||||||
switch ( $this->chart_groupby ) {
|
switch ( $this->chart_groupby ) {
|
||||||
case 'day' :
|
case 'day' :
|
||||||
$average_sales_title = sprintf( __( '%s average daily sales', 'woocommerce' ), '<strong>' . woocommerce_price( $this->average_sales ) . '</strong>' );
|
$average_sales_title = sprintf( __( '%s average daily sales', 'woocommerce' ), '<strong>' . wc_price( $this->average_sales ) . '</strong>' );
|
||||||
break;
|
break;
|
||||||
case 'month' :
|
case 'month' :
|
||||||
$average_sales_title = sprintf( __( '%s average monthly sales', 'woocommerce' ), '<strong>' . woocommerce_price( $this->average_sales ) . '</strong>' );
|
$average_sales_title = sprintf( __( '%s average monthly sales', 'woocommerce' ), '<strong>' . wc_price( $this->average_sales ) . '</strong>' );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
'title' => sprintf( __( '%s sales in this period', 'woocommerce' ), '<strong>' . woocommerce_price( $total_sales ) . '</strong>' ),
|
'title' => sprintf( __( '%s sales in this period', 'woocommerce' ), '<strong>' . wc_price( $total_sales ) . '</strong>' ),
|
||||||
'color' => $this->chart_colours['sales_amount'],
|
'color' => $this->chart_colours['sales_amount'],
|
||||||
'highlight_series' => 5
|
'highlight_series' => 5
|
||||||
);
|
);
|
||||||
|
@ -99,12 +99,12 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||||
'highlight_series' => 0
|
'highlight_series' => 0
|
||||||
);
|
);
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
'title' => sprintf( __( '%s charged for shipping', 'woocommerce' ), '<strong>' . woocommerce_price( $total_shipping ) . '</strong>' ),
|
'title' => sprintf( __( '%s charged for shipping', 'woocommerce' ), '<strong>' . wc_price( $total_shipping ) . '</strong>' ),
|
||||||
'color' => $this->chart_colours['shipping_amount'],
|
'color' => $this->chart_colours['shipping_amount'],
|
||||||
'highlight_series' => 4
|
'highlight_series' => 4
|
||||||
);
|
);
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
'title' => sprintf( __( '%s worth of coupons used', 'woocommerce' ), '<strong>' . woocommerce_price( $total_coupons ) . '</strong>' ),
|
'title' => sprintf( __( '%s worth of coupons used', 'woocommerce' ), '<strong>' . wc_price( $total_coupons ) . '</strong>' ),
|
||||||
'color' => $this->chart_colours['coupon_amount'],
|
'color' => $this->chart_colours['coupon_amount'],
|
||||||
'highlight_series' => 3
|
'highlight_series' => 3
|
||||||
);
|
);
|
||||||
|
|
|
@ -84,7 +84,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
$legend[] = array(
|
$legend[] = array(
|
||||||
'title' => sprintf( __( '%s sales for the selected items', 'woocommerce' ), '<strong>' . woocommerce_price( $total_sales ) . '</strong>' ),
|
'title' => sprintf( __( '%s sales for the selected items', 'woocommerce' ), '<strong>' . wc_price( $total_sales ) . '</strong>' ),
|
||||||
'color' => $this->chart_colours['sales_amount'],
|
'color' => $this->chart_colours['sales_amount'],
|
||||||
'highlight_series' => 1
|
'highlight_series' => 1
|
||||||
);
|
);
|
||||||
|
@ -276,7 +276,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
|
||||||
if ( $top_earners ) {
|
if ( $top_earners ) {
|
||||||
foreach ( $top_earners as $product ) {
|
foreach ( $top_earners as $product ) {
|
||||||
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
|
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
|
||||||
<td class="count">' . woocommerce_price( $product->order_item_total ) . '</td>
|
<td class="count">' . wc_price( $product->order_item_total ) . '</td>
|
||||||
<td class="name"><a href="' . add_query_arg( 'product_ids', $product->product_id ) . '">' . get_the_title( $product->product_id ) . '</a></td>
|
<td class="name"><a href="' . add_query_arg( 'product_ids', $product->product_id ) . '">' . get_the_title( $product->product_id ) . '</a></td>
|
||||||
<td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'sales' ) . '</td>
|
<td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'sales' ) . '</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
|
@ -120,9 +120,9 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" colspan="3"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
<th scope="row" colspan="3"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
||||||
<th class="total_row"><?php echo woocommerce_price( woocommerce_round_tax_total( array_sum( wp_list_pluck( (array) $tax_rows, 'tax_amount' ) ) ) ); ?></th>
|
<th class="total_row"><?php echo wc_price( wc_round_tax_total( array_sum( wp_list_pluck( (array) $tax_rows, 'tax_amount' ) ) ) ); ?></th>
|
||||||
<th class="total_row"><?php echo woocommerce_price( woocommerce_round_tax_total( array_sum( wp_list_pluck( (array) $tax_rows, 'shipping_tax_amount' ) ) ) ); ?></th>
|
<th class="total_row"><?php echo wc_price( wc_round_tax_total( array_sum( wp_list_pluck( (array) $tax_rows, 'shipping_tax_amount' ) ) ) ); ?></th>
|
||||||
<th class="total_row"><strong><?php echo woocommerce_price( woocommerce_round_tax_total( array_sum( wp_list_pluck( (array) $tax_rows, 'tax_amount' ) ) + array_sum( wp_list_pluck( (array) $tax_rows, 'shipping_tax_amount' ) ) ) ); ?></strong></th>
|
<th class="total_row"><strong><?php echo wc_price( wc_round_tax_total( array_sum( wp_list_pluck( (array) $tax_rows, 'tax_amount' ) ) + array_sum( wp_list_pluck( (array) $tax_rows, 'shipping_tax_amount' ) ) ) ); ?></strong></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -140,8 +140,8 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
$grouped_tax_tows[ $tax_row->rate_id ]->total_orders ++;
|
$grouped_tax_tows[ $tax_row->rate_id ]->total_orders ++;
|
||||||
$grouped_tax_tows[ $tax_row->rate_id ]->tax_amount += woocommerce_round_tax_total( $tax_row->tax_amount );
|
$grouped_tax_tows[ $tax_row->rate_id ]->tax_amount += wc_round_tax_total( $tax_row->tax_amount );
|
||||||
$grouped_tax_tows[ $tax_row->rate_id ]->shipping_tax_amount += woocommerce_round_tax_total( $tax_row->shipping_tax_amount );
|
$grouped_tax_tows[ $tax_row->rate_id ]->shipping_tax_amount += wc_round_tax_total( $tax_row->shipping_tax_amount );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $grouped_tax_tows as $rate_id => $tax_row ) {
|
foreach ( $grouped_tax_tows as $rate_id => $tax_row ) {
|
||||||
|
@ -151,9 +151,9 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
|
||||||
<th scope="row"><?php echo $tax_row->tax_rate; ?></th>
|
<th scope="row"><?php echo $tax_row->tax_rate; ?></th>
|
||||||
<td><?php echo $rate; ?>%</td>
|
<td><?php echo $rate; ?>%</td>
|
||||||
<td class="total_row"><?php echo $tax_row->total_orders; ?></td>
|
<td class="total_row"><?php echo $tax_row->total_orders; ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $tax_row->tax_amount ); ?></td>
|
<td class="total_row"><?php echo wc_price( $tax_row->tax_amount ); ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $tax_row->shipping_tax_amount ); ?></td>
|
<td class="total_row"><?php echo wc_price( $tax_row->shipping_tax_amount ); ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $tax_row->tax_amount + $tax_row->shipping_tax_amount ); ?></td>
|
<td class="total_row"><?php echo wc_price( $tax_row->tax_amount + $tax_row->shipping_tax_amount ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,10 +121,10 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e( 'Totals', 'woocommerce' ); ?></th>
|
<th scope="row"><?php _e( 'Totals', 'woocommerce' ); ?></th>
|
||||||
<th class="total_row"><?php echo array_sum( wp_list_pluck( (array) $tax_rows, 'total_orders' ) ); ?></th>
|
<th class="total_row"><?php echo array_sum( wp_list_pluck( (array) $tax_rows, 'total_orders' ) ); ?></th>
|
||||||
<th class="total_row"><?php echo woocommerce_price( $gross ); ?></th>
|
<th class="total_row"><?php echo wc_price( $gross ); ?></th>
|
||||||
<th class="total_row"><?php echo woocommerce_price( array_sum( wp_list_pluck( (array) $tax_rows, 'total_shipping' ) ) ); ?></th>
|
<th class="total_row"><?php echo wc_price( array_sum( wp_list_pluck( (array) $tax_rows, 'total_shipping' ) ) ); ?></th>
|
||||||
<th class="total_row"><?php echo woocommerce_price( $total_tax ); ?></th>
|
<th class="total_row"><?php echo wc_price( $total_tax ); ?></th>
|
||||||
<th class="total_row"><?php echo woocommerce_price( $gross - $total_tax ); ?></th>
|
<th class="total_row"><?php echo wc_price( $gross - $total_tax ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -141,10 +141,10 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
|
||||||
echo date_i18n( get_option( 'date_format' ), strtotime( $tax_row->post_date ) );
|
echo date_i18n( get_option( 'date_format' ), strtotime( $tax_row->post_date ) );
|
||||||
?></th>
|
?></th>
|
||||||
<td class="total_row"><?php echo $tax_row->total_orders; ?></td>
|
<td class="total_row"><?php echo $tax_row->total_orders; ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $gross ); ?></td>
|
<td class="total_row"><?php echo wc_price( $gross ); ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $tax_row->total_shipping ); ?></td>
|
<td class="total_row"><?php echo wc_price( $tax_row->total_shipping ); ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $total_tax ); ?></td>
|
<td class="total_row"><?php echo wc_price( $total_tax ); ?></td>
|
||||||
<td class="total_row"><?php echo woocommerce_price( $gross - $total_tax ); ?></td>
|
<td class="total_row"><?php echo wc_price( $gross - $total_tax ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,11 +275,11 @@ class WC_Settings_General extends WC_Settings_Page {
|
||||||
if ( isset( $_POST['woocommerce_frontend_css_primary'] ) ) {
|
if ( isset( $_POST['woocommerce_frontend_css_primary'] ) ) {
|
||||||
|
|
||||||
// Save settings
|
// Save settings
|
||||||
$primary = ( ! empty( $_POST['woocommerce_frontend_css_primary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_primary'] ) : '';
|
$primary = ( ! empty( $_POST['woocommerce_frontend_css_primary'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_primary'] ) : '';
|
||||||
$secondary = ( ! empty( $_POST['woocommerce_frontend_css_secondary'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_secondary'] ) : '';
|
$secondary = ( ! empty( $_POST['woocommerce_frontend_css_secondary'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_secondary'] ) : '';
|
||||||
$highlight = ( ! empty( $_POST['woocommerce_frontend_css_highlight'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_highlight'] ) : '';
|
$highlight = ( ! empty( $_POST['woocommerce_frontend_css_highlight'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_highlight'] ) : '';
|
||||||
$content_bg = ( ! empty( $_POST['woocommerce_frontend_css_content_bg'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_content_bg'] ) : '';
|
$content_bg = ( ! empty( $_POST['woocommerce_frontend_css_content_bg'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_content_bg'] ) : '';
|
||||||
$subtext = ( ! empty( $_POST['woocommerce_frontend_css_subtext'] ) ) ? woocommerce_format_hex( $_POST['woocommerce_frontend_css_subtext'] ) : '';
|
$subtext = ( ! empty( $_POST['woocommerce_frontend_css_subtext'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_subtext'] ) : '';
|
||||||
|
|
||||||
$colors = array(
|
$colors = array(
|
||||||
'primary' => $primary,
|
'primary' => $primary,
|
||||||
|
|
|
@ -186,7 +186,7 @@ class WC_Settings_Products extends WC_Settings_Page {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Get shop page
|
// Get shop page
|
||||||
$shop_page_id = woocommerce_get_page_id('shop');
|
$shop_page_id = wc_get_page_id('shop');
|
||||||
|
|
||||||
$base_slug = ($shop_page_id > 0 && get_page( $shop_page_id )) ? get_page_uri( $shop_page_id ) : 'shop';
|
$base_slug = ($shop_page_id > 0 && get_page( $shop_page_id )) ? get_page_uri( $shop_page_id ) : 'shop';
|
||||||
|
|
||||||
|
|
|
@ -534,13 +534,13 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
||||||
foreach ( $value as $new_key => $new_value ) {
|
foreach ( $value as $new_key => $new_value ) {
|
||||||
|
|
||||||
// Sanitize + format
|
// Sanitize + format
|
||||||
$country = strtoupper( woocommerce_clean( $tax_rate_country[ $key ][ $new_key ] ) );
|
$country = strtoupper( wc_clean( $tax_rate_country[ $key ][ $new_key ] ) );
|
||||||
$state = strtoupper( woocommerce_clean( $tax_rate_state[ $key ][ $new_key ] ) );
|
$state = strtoupper( wc_clean( $tax_rate_state[ $key ][ $new_key ] ) );
|
||||||
$postcode = woocommerce_clean( $tax_rate_postcode[ $key ][ $new_key ] );
|
$postcode = wc_clean( $tax_rate_postcode[ $key ][ $new_key ] );
|
||||||
$city = woocommerce_clean( $tax_rate_city[ $key ][ $new_key ] );
|
$city = wc_clean( $tax_rate_city[ $key ][ $new_key ] );
|
||||||
$rate = number_format( woocommerce_clean( $tax_rate[ $key ][ $new_key ] ), 4, '.', '' );
|
$rate = number_format( wc_clean( $tax_rate[ $key ][ $new_key ] ), 4, '.', '' );
|
||||||
$name = woocommerce_clean( $tax_rate_name[ $key ][ $new_key ] );
|
$name = wc_clean( $tax_rate_name[ $key ][ $new_key ] );
|
||||||
$priority = absint( woocommerce_clean( $tax_rate_priority[ $key ][ $new_key ] ) );
|
$priority = absint( wc_clean( $tax_rate_priority[ $key ][ $new_key ] ) );
|
||||||
$compound = isset( $tax_rate_compound[ $key ][ $new_key ] ) ? 1 : 0;
|
$compound = isset( $tax_rate_compound[ $key ][ $new_key ] ) ? 1 : 0;
|
||||||
$shipping = isset( $tax_rate_shipping[ $key ][ $new_key ] ) ? 1 : 0;
|
$shipping = isset( $tax_rate_shipping[ $key ][ $new_key ] ) ? 1 : 0;
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
||||||
|
|
||||||
if ( ! empty( $postcode ) ) {
|
if ( ! empty( $postcode ) ) {
|
||||||
$postcodes = explode( ';', $postcode );
|
$postcodes = explode( ';', $postcode );
|
||||||
$postcodes = array_map( 'strtoupper', array_map( 'woocommerce_clean', $postcodes ) );
|
$postcodes = array_map( 'strtoupper', array_map( 'wc_clean', $postcodes ) );
|
||||||
|
|
||||||
$postcode_query = array();
|
$postcode_query = array();
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
||||||
|
|
||||||
if ( ! empty( $city ) ) {
|
if ( ! empty( $city ) ) {
|
||||||
$cities = explode( ';', $city );
|
$cities = explode( ';', $city );
|
||||||
$cities = array_map( 'strtoupper', array_map( 'woocommerce_clean', $cities ) );
|
$cities = array_map( 'strtoupper', array_map( 'wc_clean', $cities ) );
|
||||||
foreach( $cities as $city ) {
|
foreach( $cities as $city ) {
|
||||||
$wpdb->insert(
|
$wpdb->insert(
|
||||||
$wpdb->prefix . "woocommerce_tax_rate_locations",
|
$wpdb->prefix . "woocommerce_tax_rate_locations",
|
||||||
|
@ -629,11 +629,11 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize + format
|
// Sanitize + format
|
||||||
$country = strtoupper( woocommerce_clean( $tax_rate_country[ $key ] ) );
|
$country = strtoupper( wc_clean( $tax_rate_country[ $key ] ) );
|
||||||
$state = strtoupper( woocommerce_clean( $tax_rate_state[ $key ] ) );
|
$state = strtoupper( wc_clean( $tax_rate_state[ $key ] ) );
|
||||||
$rate = number_format( woocommerce_clean( $tax_rate[ $key ] ), 4, '.', '' );
|
$rate = number_format( wc_clean( $tax_rate[ $key ] ), 4, '.', '' );
|
||||||
$name = woocommerce_clean( $tax_rate_name[ $key ] );
|
$name = wc_clean( $tax_rate_name[ $key ] );
|
||||||
$priority = absint( woocommerce_clean( $tax_rate_priority[ $key ] ) );
|
$priority = absint( wc_clean( $tax_rate_priority[ $key ] ) );
|
||||||
$compound = isset( $tax_rate_compound[ $key ] ) ? 1 : 0;
|
$compound = isset( $tax_rate_compound[ $key ] ) ? 1 : 0;
|
||||||
$shipping = isset( $tax_rate_shipping[ $key ] ) ? 1 : 0;
|
$shipping = isset( $tax_rate_shipping[ $key ] ) ? 1 : 0;
|
||||||
|
|
||||||
|
@ -669,9 +669,9 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
||||||
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d AND location_type = 'postcode';", $tax_rate_id ) );
|
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d AND location_type = 'postcode';", $tax_rate_id ) );
|
||||||
|
|
||||||
// Add changed
|
// Add changed
|
||||||
$postcode = woocommerce_clean( $tax_rate_postcode[ $key ] );
|
$postcode = wc_clean( $tax_rate_postcode[ $key ] );
|
||||||
$postcodes = explode( ';', $postcode );
|
$postcodes = explode( ';', $postcode );
|
||||||
$postcodes = array_map( 'strtoupper', array_map( 'woocommerce_clean', $postcodes ) );
|
$postcodes = array_map( 'strtoupper', array_map( 'wc_clean', $postcodes ) );
|
||||||
|
|
||||||
$postcode_query = array();
|
$postcode_query = array();
|
||||||
|
|
||||||
|
@ -704,9 +704,9 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
||||||
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d AND location_type = 'city';", $tax_rate_id ) );
|
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations WHERE tax_rate_id = %d AND location_type = 'city';", $tax_rate_id ) );
|
||||||
|
|
||||||
// Add changed
|
// Add changed
|
||||||
$city = woocommerce_clean( $tax_rate_city[ $key ] );
|
$city = wc_clean( $tax_rate_city[ $key ] );
|
||||||
$cities = explode( ';', $city );
|
$cities = explode( ';', $city );
|
||||||
$cities = array_map( 'strtoupper', array_map( 'woocommerce_clean', $cities ) );
|
$cities = array_map( 'strtoupper', array_map( 'wc_clean', $cities ) );
|
||||||
foreach( $cities as $city ) {
|
foreach( $cities as $city ) {
|
||||||
if ( $city ) {
|
if ( $city ) {
|
||||||
$wpdb->insert(
|
$wpdb->insert(
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php _e( 'WP Memory Limit','woocommerce' ); ?>:</td>
|
<td><?php _e( 'WP Memory Limit','woocommerce' ); ?>:</td>
|
||||||
<td><?php
|
<td><?php
|
||||||
$memory = woocommerce_let_to_num( WP_MEMORY_LIMIT );
|
$memory = wc_let_to_num( WP_MEMORY_LIMIT );
|
||||||
|
|
||||||
if ( $memory < 67108864 ) {
|
if ( $memory < 67108864 ) {
|
||||||
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce' ), size_format( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
|
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce' ), size_format( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
<?php if ( function_exists( 'ini_get' ) ) : ?>
|
<?php if ( function_exists( 'ini_get' ) ) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php _e('PHP Post Max Size','woocommerce' ); ?>:</td>
|
<td><?php _e('PHP Post Max Size','woocommerce' ); ?>:</td>
|
||||||
<td><?php echo size_format( woocommerce_let_to_num( ini_get('post_max_size') ) ); ?></td>
|
<td><?php echo size_format( wc_let_to_num( ini_get('post_max_size') ) ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php _e('PHP Time Limit','woocommerce' ); ?>:</td>
|
<td><?php _e('PHP Time Limit','woocommerce' ); ?>:</td>
|
||||||
|
|
|
@ -165,13 +165,13 @@ function woocommerce_compile_less_styles() {
|
||||||
// Write new color to base file
|
// Write new color to base file
|
||||||
$color_rules = "
|
$color_rules = "
|
||||||
@primary: " . $colors['primary'] . ";
|
@primary: " . $colors['primary'] . ";
|
||||||
@primarytext: " . woocommerce_light_or_dark( $colors['primary'], 'desaturate(darken(@primary,50%),18%)', 'desaturate(lighten(@primary,50%),18%)' ) . ";
|
@primarytext: " . wc_light_or_dark( $colors['primary'], 'desaturate(darken(@primary,50%),18%)', 'desaturate(lighten(@primary,50%),18%)' ) . ";
|
||||||
|
|
||||||
@secondary: " . $colors['secondary'] . ";
|
@secondary: " . $colors['secondary'] . ";
|
||||||
@secondarytext: " . woocommerce_light_or_dark( $colors['secondary'], 'desaturate(darken(@secondary,60%),18%)', 'desaturate(lighten(@secondary,60%),18%)' ) . ";
|
@secondarytext: " . wc_light_or_dark( $colors['secondary'], 'desaturate(darken(@secondary,60%),18%)', 'desaturate(lighten(@secondary,60%),18%)' ) . ";
|
||||||
|
|
||||||
@highlight: " . $colors['highlight'] . ";
|
@highlight: " . $colors['highlight'] . ";
|
||||||
@highlightext: " . woocommerce_light_or_dark( $colors['highlight'], 'desaturate(darken(@highlight,60%),18%)', 'desaturate(lighten(@highlight,60%),18%)' ) . ";
|
@highlightext: " . wc_light_or_dark( $colors['highlight'], 'desaturate(darken(@highlight,60%),18%)', 'desaturate(lighten(@highlight,60%),18%)' ) . ";
|
||||||
|
|
||||||
@contentbg: " . $colors['content_bg'] . ";
|
@contentbg: " . $colors['content_bg'] . ";
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class WC_API_Coupons extends WC_API_Resource {
|
||||||
'type' => $coupon->type,
|
'type' => $coupon->type,
|
||||||
'created_at' => $this->server->format_datetime( $coupon_post->post_date_gmt ),
|
'created_at' => $this->server->format_datetime( $coupon_post->post_date_gmt ),
|
||||||
'updated_at' => $this->server->format_datetime( $coupon_post->post_modified_gmt ),
|
'updated_at' => $this->server->format_datetime( $coupon_post->post_modified_gmt ),
|
||||||
'amount' => woocommerce_format_decimal( $coupon->amount, 2 ),
|
'amount' => wc_format_decimal( $coupon->amount, 2 ),
|
||||||
'individual_use' => ( 'yes' === $coupon->individual_use ),
|
'individual_use' => ( 'yes' === $coupon->individual_use ),
|
||||||
'product_ids' => array_map( 'absint', $coupon->product_ids ),
|
'product_ids' => array_map( 'absint', $coupon->product_ids ),
|
||||||
'exclude_product_ids' => array_map( 'absint', $coupon->exclude_product_ids ),
|
'exclude_product_ids' => array_map( 'absint', $coupon->exclude_product_ids ),
|
||||||
|
@ -130,7 +130,7 @@ class WC_API_Coupons extends WC_API_Resource {
|
||||||
'product_category_ids' => array_map( 'absint', $coupon->product_categories ),
|
'product_category_ids' => array_map( 'absint', $coupon->product_categories ),
|
||||||
'exclude_product_category_ids' => array_map( 'absint', $coupon->exclude_product_categories ),
|
'exclude_product_category_ids' => array_map( 'absint', $coupon->exclude_product_categories ),
|
||||||
'exclude_sale_items' => $coupon->exclude_sale_items(),
|
'exclude_sale_items' => $coupon->exclude_sale_items(),
|
||||||
'minimum_amount' => woocommerce_format_decimal( $coupon->minimum_amount, 2 ),
|
'minimum_amount' => wc_format_decimal( $coupon->minimum_amount, 2 ),
|
||||||
'customer_emails' => $coupon->customer_email,
|
'customer_emails' => $coupon->customer_email,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ class WC_API_Customers extends WC_API_Resource {
|
||||||
'last_order_id' => is_object( $last_order ) ? $last_order->id : null,
|
'last_order_id' => is_object( $last_order ) ? $last_order->id : null,
|
||||||
'last_order_date' => is_object( $last_order ) ? $this->server->format_datetime( $last_order->post_date_gmt ) : null,
|
'last_order_date' => is_object( $last_order ) ? $this->server->format_datetime( $last_order->post_date_gmt ) : null,
|
||||||
'orders_count' => (int) $customer->_order_count,
|
'orders_count' => (int) $customer->_order_count,
|
||||||
'total_spent' => woocommerce_format_decimal( $customer->_money_spent, 2 ),
|
'total_spent' => wc_format_decimal( $customer->_money_spent, 2 ),
|
||||||
'avatar_url' => $this->get_avatar_url( $customer->customer_email ),
|
'avatar_url' => $this->get_avatar_url( $customer->customer_email ),
|
||||||
'billing_address' => array(
|
'billing_address' => array(
|
||||||
'first_name' => $customer->billing_first_name,
|
'first_name' => $customer->billing_first_name,
|
||||||
|
|
|
@ -118,15 +118,15 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
'completed_at' => $this->server->format_datetime( $order->completed_date, true ),
|
'completed_at' => $this->server->format_datetime( $order->completed_date, true ),
|
||||||
'status' => $order->status,
|
'status' => $order->status,
|
||||||
'currency' => $order->order_currency,
|
'currency' => $order->order_currency,
|
||||||
'total' => woocommerce_format_decimal( $order->get_total(), 2 ),
|
'total' => wc_format_decimal( $order->get_total(), 2 ),
|
||||||
'total_line_items_quantity' => $order->get_item_count(),
|
'total_line_items_quantity' => $order->get_item_count(),
|
||||||
'total_tax' => woocommerce_format_decimal( $order->get_total_tax(), 2 ),
|
'total_tax' => wc_format_decimal( $order->get_total_tax(), 2 ),
|
||||||
'total_shipping' => woocommerce_format_decimal( $order->get_total_shipping(), 2 ),
|
'total_shipping' => wc_format_decimal( $order->get_total_shipping(), 2 ),
|
||||||
'cart_tax' => woocommerce_format_decimal( $order->get_cart_tax(), 2 ),
|
'cart_tax' => wc_format_decimal( $order->get_cart_tax(), 2 ),
|
||||||
'shipping_tax' => woocommerce_format_decimal( $order->get_shipping_tax(), 2 ),
|
'shipping_tax' => wc_format_decimal( $order->get_shipping_tax(), 2 ),
|
||||||
'total_discount' => woocommerce_format_decimal( $order->get_total_discount(), 2 ),
|
'total_discount' => wc_format_decimal( $order->get_total_discount(), 2 ),
|
||||||
'cart_discount' => woocommerce_format_decimal( $order->get_cart_discount(), 2 ),
|
'cart_discount' => wc_format_decimal( $order->get_cart_discount(), 2 ),
|
||||||
'order_discount' => woocommerce_format_decimal( $order->get_order_discount(), 2 ),
|
'order_discount' => wc_format_decimal( $order->get_order_discount(), 2 ),
|
||||||
'shipping_methods' => $order->get_shipping_method(),
|
'shipping_methods' => $order->get_shipping_method(),
|
||||||
'payment_details' => array(
|
'payment_details' => array(
|
||||||
'method_id' => $order->payment_method,
|
'method_id' => $order->payment_method,
|
||||||
|
@ -176,9 +176,9 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
|
|
||||||
$order_data['line_items'][] = array(
|
$order_data['line_items'][] = array(
|
||||||
'id' => $item_id,
|
'id' => $item_id,
|
||||||
'subtotal' => woocommerce_format_decimal( $order->get_line_subtotal( $item ), 2 ),
|
'subtotal' => wc_format_decimal( $order->get_line_subtotal( $item ), 2 ),
|
||||||
'total' => woocommerce_format_decimal( $order->get_line_total( $item ), 2 ),
|
'total' => wc_format_decimal( $order->get_line_total( $item ), 2 ),
|
||||||
'total_tax' => woocommerce_format_decimal( $order->get_line_tax( $item ), 2 ),
|
'total_tax' => wc_format_decimal( $order->get_line_tax( $item ), 2 ),
|
||||||
'quantity' => (int) $item['qty'],
|
'quantity' => (int) $item['qty'],
|
||||||
'tax_class' => ( ! empty( $item['tax_class'] ) ) ? $item['tax_class'] : null,
|
'tax_class' => ( ! empty( $item['tax_class'] ) ) ? $item['tax_class'] : null,
|
||||||
'name' => $item['name'],
|
'name' => $item['name'],
|
||||||
|
@ -194,7 +194,7 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
'id' => $shipping_item_id,
|
'id' => $shipping_item_id,
|
||||||
'method_id' => $shipping_item['method_id'],
|
'method_id' => $shipping_item['method_id'],
|
||||||
'method_title' => $shipping_item['name'],
|
'method_title' => $shipping_item['name'],
|
||||||
'total' => woocommerce_format_decimal( $shipping_item['cost'], 2 ),
|
'total' => wc_format_decimal( $shipping_item['cost'], 2 ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
$order_data['tax_lines'][] = array(
|
$order_data['tax_lines'][] = array(
|
||||||
'code' => $tax_code,
|
'code' => $tax_code,
|
||||||
'title' => $tax->label,
|
'title' => $tax->label,
|
||||||
'total' => woocommerce_format_decimal( $tax->amount, 2 ),
|
'total' => wc_format_decimal( $tax->amount, 2 ),
|
||||||
'compound' => (bool) $tax->is_compound,
|
'compound' => (bool) $tax->is_compound,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -216,8 +216,8 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
'id' => $fee_item_id,
|
'id' => $fee_item_id,
|
||||||
'title' => $fee_item['name'],
|
'title' => $fee_item['name'],
|
||||||
'tax_class' => ( ! empty( $fee_item['tax_class'] ) ) ? $fee_item['tax_class'] : null,
|
'tax_class' => ( ! empty( $fee_item['tax_class'] ) ) ? $fee_item['tax_class'] : null,
|
||||||
'total' => woocommerce_format_decimal( $order->get_line_total( $fee_item ), 2 ),
|
'total' => wc_format_decimal( $order->get_line_total( $fee_item ), 2 ),
|
||||||
'total_tax' => woocommerce_format_decimal( $order->get_line_tax( $fee_item ), 2 ),
|
'total_tax' => wc_format_decimal( $order->get_line_tax( $fee_item ), 2 ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
$order_data['coupon_lines'] = array(
|
$order_data['coupon_lines'] = array(
|
||||||
'id' => $coupon_item_id,
|
'id' => $coupon_item_id,
|
||||||
'code' => $coupon_item['name'],
|
'code' => $coupon_item['name'],
|
||||||
'amount' => woocommerce_format_decimal( $coupon_item['discount_amount'], 2 ),
|
'amount' => wc_format_decimal( $coupon_item['discount_amount'], 2 ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ class WC_API_Products extends WC_API_Resource {
|
||||||
'rating' => get_comment_meta( $comment->comment_ID, 'rating', true ),
|
'rating' => get_comment_meta( $comment->comment_ID, 'rating', true ),
|
||||||
'reviewer_name' => $comment->comment_author,
|
'reviewer_name' => $comment->comment_author,
|
||||||
'reviewer_email' => $comment->comment_author_email,
|
'reviewer_email' => $comment->comment_author_email,
|
||||||
'verified' => (bool) woocommerce_customer_bought_product( $comment->comment_author_email, $comment->user_id, $id ),
|
'verified' => (bool) wc_customer_bought_product( $comment->comment_author_email, $comment->user_id, $id ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,9 +278,9 @@ class WC_API_Products extends WC_API_Resource {
|
||||||
'virtual' => $product->is_virtual(),
|
'virtual' => $product->is_virtual(),
|
||||||
'permalink' => $product->get_permalink(),
|
'permalink' => $product->get_permalink(),
|
||||||
'sku' => $product->get_sku(),
|
'sku' => $product->get_sku(),
|
||||||
'price' => woocommerce_format_decimal( $product->get_price(), 2 ),
|
'price' => wc_format_decimal( $product->get_price(), 2 ),
|
||||||
'regular_price' => woocommerce_format_decimal( $product->get_regular_price(), 2 ),
|
'regular_price' => wc_format_decimal( $product->get_regular_price(), 2 ),
|
||||||
'sale_price' => $product->get_sale_price() ? woocommerce_format_decimal( $product->get_sale_price(), 2 ) : null,
|
'sale_price' => $product->get_sale_price() ? wc_format_decimal( $product->get_sale_price(), 2 ) : null,
|
||||||
'price_html' => $product->get_price_html(),
|
'price_html' => $product->get_price_html(),
|
||||||
'taxable' => $product->is_taxable(),
|
'taxable' => $product->is_taxable(),
|
||||||
'tax_status' => $product->get_tax_status(),
|
'tax_status' => $product->get_tax_status(),
|
||||||
|
@ -296,7 +296,7 @@ class WC_API_Products extends WC_API_Resource {
|
||||||
'visible' => $product->is_visible(),
|
'visible' => $product->is_visible(),
|
||||||
'catalog_visibility' => $product->visibility,
|
'catalog_visibility' => $product->visibility,
|
||||||
'on_sale' => $product->is_on_sale(),
|
'on_sale' => $product->is_on_sale(),
|
||||||
'weight' => $product->get_weight() ? woocommerce_format_decimal( $product->get_weight(), 2 ) : null,
|
'weight' => $product->get_weight() ? wc_format_decimal( $product->get_weight(), 2 ) : null,
|
||||||
'dimensions' => array(
|
'dimensions' => array(
|
||||||
'length' => $product->length,
|
'length' => $product->length,
|
||||||
'width' => $product->width,
|
'width' => $product->width,
|
||||||
|
@ -310,7 +310,7 @@ class WC_API_Products extends WC_API_Resource {
|
||||||
'description' => apply_filters( 'the_content', $product->get_post_data()->post_content ),
|
'description' => apply_filters( 'the_content', $product->get_post_data()->post_content ),
|
||||||
'short_description' => apply_filters( 'woocommerce_short_description', $product->get_post_data()->post_excerpt ),
|
'short_description' => apply_filters( 'woocommerce_short_description', $product->get_post_data()->post_excerpt ),
|
||||||
'reviews_allowed' => ( 'open' === $product->get_post_data()->comment_status ),
|
'reviews_allowed' => ( 'open' === $product->get_post_data()->comment_status ),
|
||||||
'average_rating' => woocommerce_format_decimal( $product->get_average_rating(), 2 ),
|
'average_rating' => wc_format_decimal( $product->get_average_rating(), 2 ),
|
||||||
'rating_count' => (int) $product->get_rating_count(),
|
'rating_count' => (int) $product->get_rating_count(),
|
||||||
'related_ids' => array_map( 'absint', array_values( $product->get_related() ) ),
|
'related_ids' => array_map( 'absint', array_values( $product->get_related() ) ),
|
||||||
'upsell_ids' => array_map( 'absint', $product->get_upsells() ),
|
'upsell_ids' => array_map( 'absint', $product->get_upsells() ),
|
||||||
|
@ -356,9 +356,9 @@ class WC_API_Products extends WC_API_Resource {
|
||||||
'virtual' => $variation->is_virtual(),
|
'virtual' => $variation->is_virtual(),
|
||||||
'permalink' => $variation->get_permalink(),
|
'permalink' => $variation->get_permalink(),
|
||||||
'sku' => $variation->get_sku(),
|
'sku' => $variation->get_sku(),
|
||||||
'price' => woocommerce_format_decimal( $variation->get_price(), 2 ),
|
'price' => wc_format_decimal( $variation->get_price(), 2 ),
|
||||||
'regular_price' => woocommerce_format_decimal( $variation->get_regular_price(), 2 ),
|
'regular_price' => wc_format_decimal( $variation->get_regular_price(), 2 ),
|
||||||
'sale_price' => $variation->get_sale_price() ? woocommerce_format_decimal( $variation->get_sale_price(), 2 ) : null,
|
'sale_price' => $variation->get_sale_price() ? wc_format_decimal( $variation->get_sale_price(), 2 ) : null,
|
||||||
'taxable' => $variation->is_taxable(),
|
'taxable' => $variation->is_taxable(),
|
||||||
'tax_status' => $variation->get_tax_status(),
|
'tax_status' => $variation->get_tax_status(),
|
||||||
'tax_class' => $variation->get_tax_class(),
|
'tax_class' => $variation->get_tax_class(),
|
||||||
|
@ -368,7 +368,7 @@ class WC_API_Products extends WC_API_Resource {
|
||||||
'purchaseable' => $variation->is_purchasable(),
|
'purchaseable' => $variation->is_purchasable(),
|
||||||
'visible' => $variation->variation_is_visible(),
|
'visible' => $variation->variation_is_visible(),
|
||||||
'on_sale' => $variation->is_on_sale(),
|
'on_sale' => $variation->is_on_sale(),
|
||||||
'weight' => $variation->get_weight() ? woocommerce_format_decimal( $variation->get_weight(), 2 ) : null,
|
'weight' => $variation->get_weight() ? wc_format_decimal( $variation->get_weight(), 2 ) : null,
|
||||||
'dimensions' => array(
|
'dimensions' => array(
|
||||||
'length' => $variation->length,
|
'length' => $variation->length,
|
||||||
'width' => $variation->width,
|
'width' => $variation->width,
|
||||||
|
|
|
@ -272,12 +272,12 @@ class WC_API_Reports extends WC_API_Resource {
|
||||||
}
|
}
|
||||||
|
|
||||||
$period_totals[ $time ] = array(
|
$period_totals[ $time ] = array(
|
||||||
'sales' => woocommerce_format_decimal( 0.00, 2 ),
|
'sales' => wc_format_decimal( 0.00, 2 ),
|
||||||
'orders' => 0,
|
'orders' => 0,
|
||||||
'items' => 0,
|
'items' => 0,
|
||||||
'tax' => woocommerce_format_decimal( 0.00, 2 ),
|
'tax' => wc_format_decimal( 0.00, 2 ),
|
||||||
'shipping' => woocommerce_format_decimal( 0.00, 2 ),
|
'shipping' => wc_format_decimal( 0.00, 2 ),
|
||||||
'discount' => woocommerce_format_decimal( 0.00, 2 ),
|
'discount' => wc_format_decimal( 0.00, 2 ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,10 +289,10 @@ class WC_API_Reports extends WC_API_Resource {
|
||||||
if ( ! isset( $period_totals[ $time ] ) )
|
if ( ! isset( $period_totals[ $time ] ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$period_totals[ $time ]['sales'] = woocommerce_format_decimal( $order->total_sales, 2 );
|
$period_totals[ $time ]['sales'] = wc_format_decimal( $order->total_sales, 2 );
|
||||||
$period_totals[ $time ]['orders'] = (int) $order->total_orders;
|
$period_totals[ $time ]['orders'] = (int) $order->total_orders;
|
||||||
$period_totals[ $time ]['tax'] = woocommerce_format_decimal( $order->total_tax + $order->total_shipping_tax, 2 );
|
$period_totals[ $time ]['tax'] = wc_format_decimal( $order->total_tax + $order->total_shipping_tax, 2 );
|
||||||
$period_totals[ $time ]['shipping'] = woocommerce_format_decimal( $order->total_shipping, 2 );
|
$period_totals[ $time ]['shipping'] = wc_format_decimal( $order->total_shipping, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// add total order items for each period
|
// add total order items for each period
|
||||||
|
@ -314,17 +314,17 @@ class WC_API_Reports extends WC_API_Resource {
|
||||||
if ( ! isset( $period_totals[ $time ] ) )
|
if ( ! isset( $period_totals[ $time ] ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$period_totals[ $time ]['discount'] = woocommerce_format_decimal( $discount->discount_amount, 2 );
|
$period_totals[ $time ]['discount'] = wc_format_decimal( $discount->discount_amount, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
$sales_data = array(
|
$sales_data = array(
|
||||||
'total_sales' => woocommerce_format_decimal( $totals->sales, 2 ),
|
'total_sales' => wc_format_decimal( $totals->sales, 2 ),
|
||||||
'average_sales' => woocommerce_format_decimal( $totals->sales / ( $this->report->chart_interval + 1 ), 2 ),
|
'average_sales' => wc_format_decimal( $totals->sales / ( $this->report->chart_interval + 1 ), 2 ),
|
||||||
'total_orders' => (int) $totals->order_count,
|
'total_orders' => (int) $totals->order_count,
|
||||||
'total_items' => $total_items,
|
'total_items' => $total_items,
|
||||||
'total_tax' => woocommerce_format_decimal( $totals->tax + $totals->shipping_tax, 2 ),
|
'total_tax' => wc_format_decimal( $totals->tax + $totals->shipping_tax, 2 ),
|
||||||
'total_shipping' => woocommerce_format_decimal( $totals->shipping, 2 ),
|
'total_shipping' => wc_format_decimal( $totals->shipping, 2 ),
|
||||||
'total_discount' => is_null( $total_discount ) ? woocommerce_format_decimal( 0.00, 2 ) : woocommerce_format_decimal( $total_discount, 2 ),
|
'total_discount' => is_null( $total_discount ) ? wc_format_decimal( 0.00, 2 ) : wc_format_decimal( $total_discount, 2 ),
|
||||||
'totals_grouped_by' => $this->report->chart_groupby,
|
'totals_grouped_by' => $this->report->chart_groupby,
|
||||||
'totals' => $period_totals,
|
'totals' => $period_totals,
|
||||||
'total_customers' => $total_customers,
|
'total_customers' => $total_customers,
|
||||||
|
|
|
@ -424,7 +424,7 @@ class WC_API_Server {
|
||||||
'URL' => get_option( 'siteurl' ),
|
'URL' => get_option( 'siteurl' ),
|
||||||
'routes' => array(),
|
'routes' => array(),
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'timezone' => woocommerce_timezone_string(),
|
'timezone' => wc_timezone_string(),
|
||||||
'currency' => get_woocommerce_currency(),
|
'currency' => get_woocommerce_currency(),
|
||||||
'money_format' => get_woocommerce_currency_symbol(),
|
'money_format' => get_woocommerce_currency_symbol(),
|
||||||
'tax_included' => ( 'yes' === get_option( 'woocommerce_prices_include_tax' ) ),
|
'tax_included' => ( 'yes' === get_option( 'woocommerce_prices_include_tax' ) ),
|
||||||
|
@ -647,7 +647,7 @@ class WC_API_Server {
|
||||||
public function format_datetime( $timestamp, $convert_to_utc = false ) {
|
public function format_datetime( $timestamp, $convert_to_utc = false ) {
|
||||||
|
|
||||||
if ( $convert_to_utc ) {
|
if ( $convert_to_utc ) {
|
||||||
$timezone = new DateTimeZone( woocommerce_timezone_string() );
|
$timezone = new DateTimeZone( wc_timezone_string() );
|
||||||
} else {
|
} else {
|
||||||
$timezone = new DateTimeZone( 'UTC' );
|
$timezone = new DateTimeZone( 'UTC' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) )
|
if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) )
|
||||||
foreach ( $_POST['shipping_method'] as $i => $value )
|
foreach ( $_POST['shipping_method'] as $i => $value )
|
||||||
$chosen_shipping_methods[ $i ] = woocommerce_clean( $value );
|
$chosen_shipping_methods[ $i ] = wc_clean( $value );
|
||||||
|
|
||||||
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) )
|
if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) )
|
||||||
foreach ( $_POST['shipping_method'] as $i => $value )
|
foreach ( $_POST['shipping_method'] as $i => $value )
|
||||||
$chosen_shipping_methods[ $i ] = woocommerce_clean( $value );
|
$chosen_shipping_methods[ $i ] = wc_clean( $value );
|
||||||
|
|
||||||
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
||||||
WC()->session->set( 'chosen_payment_method', empty( $_POST['payment_method'] ) ? '' : $_POST['payment_method'] );
|
WC()->session->set( 'chosen_payment_method', empty( $_POST['payment_method'] ) ? '' : $_POST['payment_method'] );
|
||||||
|
@ -225,7 +225,7 @@ class WC_AJAX {
|
||||||
do_action( 'woocommerce_ajax_added_to_cart', $product_id );
|
do_action( 'woocommerce_ajax_added_to_cart', $product_id );
|
||||||
|
|
||||||
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) {
|
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) {
|
||||||
woocommerce_add_to_cart_message( $product_id );
|
wc_add_to_cart_message( $product_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return fragments
|
// Return fragments
|
||||||
|
@ -449,7 +449,7 @@ class WC_AJAX {
|
||||||
if ( $values ) {
|
if ( $values ) {
|
||||||
// Add attribute to array, but don't set values
|
// Add attribute to array, but don't set values
|
||||||
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
||||||
'name' => woocommerce_clean( $attribute_names[ $i ] ),
|
'name' => wc_clean( $attribute_names[ $i ] ),
|
||||||
'value' => '',
|
'value' => '',
|
||||||
'position' => $attribute_position[ $i ],
|
'position' => $attribute_position[ $i ],
|
||||||
'is_visible' => $is_visible,
|
'is_visible' => $is_visible,
|
||||||
|
@ -461,11 +461,11 @@ class WC_AJAX {
|
||||||
} elseif ( isset( $attribute_values[ $i ] ) ) {
|
} elseif ( isset( $attribute_values[ $i ] ) ) {
|
||||||
|
|
||||||
// Text based, separate by pipe
|
// Text based, separate by pipe
|
||||||
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'woocommerce_clean', array_map( 'stripslashes', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) ) );
|
$values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', array_map( 'stripslashes', explode( WC_DELIMITER, $attribute_values[ $i ] ) ) ) );
|
||||||
|
|
||||||
// Custom attribute - Add attribute to array and set the values
|
// Custom attribute - Add attribute to array and set the values
|
||||||
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
|
||||||
'name' => woocommerce_clean( $attribute_names[ $i ] ),
|
'name' => wc_clean( $attribute_names[ $i ] ),
|
||||||
'value' => $values,
|
'value' => $values,
|
||||||
'position' => $attribute_position[ $i ],
|
'position' => $attribute_position[ $i ],
|
||||||
'is_visible' => $is_visible,
|
'is_visible' => $is_visible,
|
||||||
|
@ -767,7 +767,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
if ( $files ) {
|
if ( $files ) {
|
||||||
foreach ( $files as $download_id => $file ) {
|
foreach ( $files as $download_id => $file ) {
|
||||||
if ( $inserted_id = woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) ) {
|
if ( $inserted_id = wc_downloadable_file_permission( $download_id, $product_id, $order ) ) {
|
||||||
|
|
||||||
// insert complete - get inserted data
|
// insert complete - get inserted data
|
||||||
$download = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE permission_id = %d", $inserted_id ) );
|
$download = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE permission_id = %d", $inserted_id ) );
|
||||||
|
@ -850,27 +850,27 @@ class WC_AJAX {
|
||||||
$item['name'] = $_product->get_title();
|
$item['name'] = $_product->get_title();
|
||||||
$item['tax_class'] = $_product->get_tax_class();
|
$item['tax_class'] = $_product->get_tax_class();
|
||||||
$item['qty'] = 1;
|
$item['qty'] = 1;
|
||||||
$item['line_subtotal'] = woocommerce_format_decimal( $_product->get_price_excluding_tax() );
|
$item['line_subtotal'] = wc_format_decimal( $_product->get_price_excluding_tax() );
|
||||||
$item['line_subtotal_tax'] = '';
|
$item['line_subtotal_tax'] = '';
|
||||||
$item['line_total'] = woocommerce_format_decimal( $_product->get_price_excluding_tax() );
|
$item['line_total'] = wc_format_decimal( $_product->get_price_excluding_tax() );
|
||||||
$item['line_tax'] = '';
|
$item['line_tax'] = '';
|
||||||
|
|
||||||
// Add line item
|
// Add line item
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => $item['name'],
|
'order_item_name' => $item['name'],
|
||||||
'order_item_type' => 'line_item'
|
'order_item_type' => 'line_item'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, '_qty', $item['qty'] );
|
wc_add_order_item_meta( $item_id, '_qty', $item['qty'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_tax_class', $item['tax_class'] );
|
wc_add_order_item_meta( $item_id, '_tax_class', $item['tax_class'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_product_id', $item['product_id'] );
|
wc_add_order_item_meta( $item_id, '_product_id', $item['product_id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_variation_id', $item['variation_id'] );
|
wc_add_order_item_meta( $item_id, '_variation_id', $item['variation_id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_subtotal', $item['line_subtotal'] );
|
wc_add_order_item_meta( $item_id, '_line_subtotal', $item['line_subtotal'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_subtotal_tax', $item['line_subtotal_tax'] );
|
wc_add_order_item_meta( $item_id, '_line_subtotal_tax', $item['line_subtotal_tax'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_total', $item['line_total'] );
|
wc_add_order_item_meta( $item_id, '_line_total', $item['line_total'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_tax', $item['line_tax'] );
|
wc_add_order_item_meta( $item_id, '_line_tax', $item['line_tax'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
do_action( 'woocommerce_ajax_add_order_item_meta', $item_id, $item );
|
do_action( 'woocommerce_ajax_add_order_item_meta', $item_id, $item );
|
||||||
|
@ -894,16 +894,16 @@ class WC_AJAX {
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
|
|
||||||
// Add line item
|
// Add line item
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => '',
|
'order_item_name' => '',
|
||||||
'order_item_type' => 'fee'
|
'order_item_type' => 'fee'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, '_tax_class', '' );
|
wc_add_order_item_meta( $item_id, '_tax_class', '' );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_total', '' );
|
wc_add_order_item_meta( $item_id, '_line_total', '' );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_tax', '' );
|
wc_add_order_item_meta( $item_id, '_line_tax', '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
include( 'includes/admin/post-types/meta-boxes/views/html-order-fee.php' );
|
include( 'includes/admin/post-types/meta-boxes/views/html-order-fee.php' );
|
||||||
|
@ -924,7 +924,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
if ( sizeof( $order_item_ids ) > 0 ) {
|
if ( sizeof( $order_item_ids ) > 0 ) {
|
||||||
foreach( $order_item_ids as $id ) {
|
foreach( $order_item_ids as $id ) {
|
||||||
woocommerce_delete_order_item( absint( $id ) );
|
wc_delete_order_item( absint( $id ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
check_ajax_referer( 'order-item', 'security' );
|
check_ajax_referer( 'order-item', 'security' );
|
||||||
|
|
||||||
$meta_id = woocommerce_add_order_item_meta( absint( $_POST['order_item_id'] ), __( 'Name', 'woocommerce' ), __( 'Value', 'woocommerce' ) );
|
$meta_id = wc_add_order_item_meta( absint( $_POST['order_item_id'] ), __( 'Name', 'woocommerce' ), __( 'Value', 'woocommerce' ) );
|
||||||
|
|
||||||
if ( $meta_id ) {
|
if ( $meta_id ) {
|
||||||
|
|
||||||
|
@ -1090,8 +1090,8 @@ class WC_AJAX {
|
||||||
foreach( $items as $item_id => $item ) {
|
foreach( $items as $item_id => $item ) {
|
||||||
|
|
||||||
$item_id = absint( $item_id );
|
$item_id = absint( $item_id );
|
||||||
$line_subtotal = isset( $item['line_subtotal'] ) ? woocommerce_format_decimal( $item['line_subtotal'] ) : 0;
|
$line_subtotal = isset( $item['line_subtotal'] ) ? wc_format_decimal( $item['line_subtotal'] ) : 0;
|
||||||
$line_total = woocommerce_format_decimal( $item['line_total'] );
|
$line_total = wc_format_decimal( $item['line_total'] );
|
||||||
$tax_class = sanitize_text_field( $item['tax_class'] );
|
$tax_class = sanitize_text_field( $item['tax_class'] );
|
||||||
$product_id = $order->get_item_meta( $item_id, '_product_id', true );
|
$product_id = $order->get_item_meta( $item_id, '_product_id', true );
|
||||||
|
|
||||||
|
@ -1193,25 +1193,25 @@ class WC_AJAX {
|
||||||
$item['name'] = $tax_codes[ $key ];
|
$item['name'] = $tax_codes[ $key ];
|
||||||
$item['label'] = $tax->get_rate_label( $key );
|
$item['label'] = $tax->get_rate_label( $key );
|
||||||
$item['compound'] = $tax->is_compound( $key ) ? 1 : 0;
|
$item['compound'] = $tax->is_compound( $key ) ? 1 : 0;
|
||||||
$item['tax_amount'] = woocommerce_format_decimal( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
$item['tax_amount'] = wc_format_decimal( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 );
|
||||||
$item['shipping_tax_amount'] = woocommerce_format_decimal( isset( $shipping_taxes[ $key ] ) ? $shipping_taxes[ $key ] : 0 );
|
$item['shipping_tax_amount'] = wc_format_decimal( isset( $shipping_taxes[ $key ] ) ? $shipping_taxes[ $key ] : 0 );
|
||||||
|
|
||||||
if ( ! $item['label'] )
|
if ( ! $item['label'] )
|
||||||
$item['label'] = WC()->countries->tax_or_vat();
|
$item['label'] = WC()->countries->tax_or_vat();
|
||||||
|
|
||||||
// Add line item
|
// Add line item
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => $item['name'],
|
'order_item_name' => $item['name'],
|
||||||
'order_item_type' => 'tax'
|
'order_item_type' => 'tax'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, 'rate_id', $item['rate_id'] );
|
wc_add_order_item_meta( $item_id, 'rate_id', $item['rate_id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'label', $item['label'] );
|
wc_add_order_item_meta( $item_id, 'label', $item['label'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'compound', $item['compound'] );
|
wc_add_order_item_meta( $item_id, 'compound', $item['compound'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'tax_amount', $item['tax_amount'] );
|
wc_add_order_item_meta( $item_id, 'tax_amount', $item['tax_amount'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'shipping_tax_amount', $item['shipping_tax_amount'] );
|
wc_add_order_item_meta( $item_id, 'shipping_tax_amount', $item['shipping_tax_amount'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
include( 'includes/admin/post-types/meta-boxes/views/html-order-tax.php' );
|
include( 'includes/admin/post-types/meta-boxes/views/html-order-tax.php' );
|
||||||
|
@ -1289,7 +1289,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
$this->json_headers();
|
$this->json_headers();
|
||||||
|
|
||||||
$term = (string) woocommerce_clean( urldecode( stripslashes( $_GET['term'] ) ) );
|
$term = (string) wc_clean( urldecode( stripslashes( $_GET['term'] ) ) );
|
||||||
|
|
||||||
if (empty($term)) die();
|
if (empty($term)) die();
|
||||||
|
|
||||||
|
@ -1392,7 +1392,7 @@ class WC_AJAX {
|
||||||
|
|
||||||
$this->json_headers();
|
$this->json_headers();
|
||||||
|
|
||||||
$term = woocommerce_clean( urldecode( stripslashes( $_GET['term'] ) ) );
|
$term = wc_clean( urldecode( stripslashes( $_GET['term'] ) ) );
|
||||||
|
|
||||||
if ( empty( $term ) )
|
if ( empty( $term ) )
|
||||||
die();
|
die();
|
||||||
|
@ -1432,7 +1432,7 @@ class WC_AJAX {
|
||||||
public function json_search_customer_name( $query ) {
|
public function json_search_customer_name( $query ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$term = woocommerce_clean( urldecode( stripslashes( $_GET['term'] ) ) );
|
$term = wc_clean( urldecode( stripslashes( $_GET['term'] ) ) );
|
||||||
|
|
||||||
$query->query_from .= " LEFT JOIN {$wpdb->usermeta} as meta2 ON ({$wpdb->users}.ID = meta2.user_id) ";
|
$query->query_from .= " LEFT JOIN {$wpdb->usermeta} as meta2 ON ({$wpdb->users}.ID = meta2.user_id) ";
|
||||||
$query->query_from .= " LEFT JOIN {$wpdb->usermeta} as meta3 ON ({$wpdb->users}.ID = meta3.user_id) ";
|
$query->query_from .= " LEFT JOIN {$wpdb->usermeta} as meta3 ON ({$wpdb->users}.ID = meta3.user_id) ";
|
||||||
|
|
|
@ -33,20 +33,20 @@ class WC_Cache_Helper {
|
||||||
public function init() {
|
public function init() {
|
||||||
if ( false === ( $wc_page_uris = get_transient( 'woocommerce_cache_excluded_uris' ) ) ) {
|
if ( false === ( $wc_page_uris = get_transient( 'woocommerce_cache_excluded_uris' ) ) ) {
|
||||||
|
|
||||||
if ( woocommerce_get_page_id( 'cart' ) < 1 || woocommerce_get_page_id( 'checkout' ) < 1 || woocommerce_get_page_id( 'myaccount' ) < 1 )
|
if ( wc_get_page_id( 'cart' ) < 1 || wc_get_page_id( 'checkout' ) < 1 || wc_get_page_id( 'myaccount' ) < 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$wc_page_uris = array();
|
$wc_page_uris = array();
|
||||||
|
|
||||||
// Exclude querystring when using page ID
|
// Exclude querystring when using page ID
|
||||||
$wc_page_uris[] = 'p=' . woocommerce_get_page_id( 'cart' );
|
$wc_page_uris[] = 'p=' . wc_get_page_id( 'cart' );
|
||||||
$wc_page_uris[] = 'p=' . woocommerce_get_page_id( 'checkout' );
|
$wc_page_uris[] = 'p=' . wc_get_page_id( 'checkout' );
|
||||||
$wc_page_uris[] = 'p=' . woocommerce_get_page_id( 'myaccount' );
|
$wc_page_uris[] = 'p=' . wc_get_page_id( 'myaccount' );
|
||||||
|
|
||||||
// Exclude permalinks
|
// Exclude permalinks
|
||||||
$cart_page = get_post( woocommerce_get_page_id( 'cart' ) );
|
$cart_page = get_post( wc_get_page_id( 'cart' ) );
|
||||||
$checkout_page = get_post( woocommerce_get_page_id( 'checkout' ) );
|
$checkout_page = get_post( wc_get_page_id( 'checkout' ) );
|
||||||
$account_page = get_post( woocommerce_get_page_id( 'myaccount' ) );
|
$account_page = get_post( wc_get_page_id( 'myaccount' ) );
|
||||||
|
|
||||||
if ( ! is_null( $cart_page ) )
|
if ( ! is_null( $cart_page ) )
|
||||||
$wc_page_uris[] = '/' . $cart_page->post_name;
|
$wc_page_uris[] = '/' . $cart_page->post_name;
|
||||||
|
|
|
@ -543,7 +543,7 @@ class WC_Cart {
|
||||||
echo esc_html( $data['key'] ) . ': ' . wp_kses_post( $data['value'] ) . "\n";
|
echo esc_html( $data['key'] ) . ': ' . wp_kses_post( $data['value'] ) . "\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
woocommerce_get_template( 'cart/cart-item-data.php', array( 'item_data' => $item_data ) );
|
wc_get_template( 'cart/cart-item-data.php', array( 'item_data' => $item_data ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
@ -576,7 +576,7 @@ class WC_Cart {
|
||||||
* @return string url to page
|
* @return string url to page
|
||||||
*/
|
*/
|
||||||
public function get_cart_url() {
|
public function get_cart_url() {
|
||||||
$cart_page_id = woocommerce_get_page_id('cart');
|
$cart_page_id = wc_get_page_id('cart');
|
||||||
if ( $cart_page_id )
|
if ( $cart_page_id )
|
||||||
return apply_filters( 'woocommerce_get_cart_url', get_permalink( $cart_page_id ) );
|
return apply_filters( 'woocommerce_get_cart_url', get_permalink( $cart_page_id ) );
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ class WC_Cart {
|
||||||
* @return string url to page
|
* @return string url to page
|
||||||
*/
|
*/
|
||||||
public function get_checkout_url() {
|
public function get_checkout_url() {
|
||||||
$checkout_page_id = woocommerce_get_page_id('checkout');
|
$checkout_page_id = wc_get_page_id('checkout');
|
||||||
$checkout_url = '';
|
$checkout_url = '';
|
||||||
if ( $checkout_page_id ) {
|
if ( $checkout_page_id ) {
|
||||||
if ( is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' )
|
if ( is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' )
|
||||||
|
@ -604,7 +604,7 @@ class WC_Cart {
|
||||||
* @return string url to page
|
* @return string url to page
|
||||||
*/
|
*/
|
||||||
public function get_remove_url( $cart_item_key ) {
|
public function get_remove_url( $cart_item_key ) {
|
||||||
$cart_page_id = woocommerce_get_page_id('cart');
|
$cart_page_id = wc_get_page_id('cart');
|
||||||
if ( $cart_page_id )
|
if ( $cart_page_id )
|
||||||
return apply_filters( 'woocommerce_get_remove_url', wp_nonce_url( add_query_arg( 'remove_item', $cart_item_key, get_permalink( $cart_page_id ) ), 'woocommerce-cart' ) );
|
return apply_filters( 'woocommerce_get_remove_url', wp_nonce_url( add_query_arg( 'remove_item', $cart_item_key, get_permalink( $cart_page_id ) ), 'woocommerce-cart' ) );
|
||||||
}
|
}
|
||||||
|
@ -675,8 +675,8 @@ class WC_Cart {
|
||||||
$tax_totals[ $code ]->tax_rate_id = $key;
|
$tax_totals[ $code ]->tax_rate_id = $key;
|
||||||
$tax_totals[ $code ]->is_compound = $this->tax->is_compound( $key );
|
$tax_totals[ $code ]->is_compound = $this->tax->is_compound( $key );
|
||||||
$tax_totals[ $code ]->label = $this->tax->get_rate_label( $key );
|
$tax_totals[ $code ]->label = $this->tax->get_rate_label( $key );
|
||||||
$tax_totals[ $code ]->amount += woocommerce_round_tax_total( $tax );
|
$tax_totals[ $code ]->amount += wc_round_tax_total( $tax );
|
||||||
$tax_totals[ $code ]->formatted_amount = woocommerce_price( woocommerce_round_tax_total( $tax_totals[ $code ]->amount ) );
|
$tax_totals[ $code ]->formatted_amount = wc_price( wc_round_tax_total( $tax_totals[ $code ]->amount ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_cart_tax_totals', $tax_totals, $this );
|
return apply_filters( 'woocommerce_cart_tax_totals', $tax_totals, $this );
|
||||||
|
@ -794,7 +794,7 @@ class WC_Cart {
|
||||||
|
|
||||||
// If its greater than 0, its already in the cart
|
// If its greater than 0, its already in the cart
|
||||||
if ( $in_cart_quantity > 0 ) {
|
if ( $in_cart_quantity > 0 ) {
|
||||||
wc_add_notice( sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', get_permalink( woocommerce_get_page_id( 'cart' ) ), __( 'View Cart', 'woocommerce' ), sprintf( __( 'You cannot add another "%s" to your cart.', 'woocommerce' ), $product_data->get_title() ) ), 'error' );
|
wc_add_notice( sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', get_permalink( wc_get_page_id( 'cart' ) ), __( 'View Cart', 'woocommerce' ), sprintf( __( 'You cannot add another "%s" to your cart.', 'woocommerce' ), $product_data->get_title() ) ), 'error' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -808,7 +808,7 @@ class WC_Cart {
|
||||||
if ( $variation_id && $product_data->variation_has_stock ) {
|
if ( $variation_id && $product_data->variation_has_stock ) {
|
||||||
|
|
||||||
if ( isset( $product_qty_in_cart[ $variation_id ] ) && ! $product_data->has_enough_stock( $product_qty_in_cart[ $variation_id ] + $quantity ) ) {
|
if ( isset( $product_qty_in_cart[ $variation_id ] ) && ! $product_data->has_enough_stock( $product_qty_in_cart[ $variation_id ] + $quantity ) ) {
|
||||||
wc_add_notice( sprintf(__( '<a href="%s" class="button wc-forward">%s</a> You cannot add that amount to the cart — we have %s in stock and you already have %s in your cart.', 'woocommerce' ), get_permalink( woocommerce_get_page_id( 'cart' ) ), __( 'View Cart', 'woocommerce' ), $product_data->get_stock_quantity(), $product_qty_in_cart[ $variation_id ] ), 'error' );
|
wc_add_notice( sprintf(__( '<a href="%s" class="button wc-forward">%s</a> You cannot add that amount to the cart — we have %s in stock and you already have %s in your cart.', 'woocommerce' ), get_permalink( wc_get_page_id( 'cart' ) ), __( 'View Cart', 'woocommerce' ), $product_data->get_stock_quantity(), $product_qty_in_cart[ $variation_id ] ), 'error' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,7 +816,7 @@ class WC_Cart {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( isset( $product_qty_in_cart[ $product_id ] ) && ! $product_data->has_enough_stock( $product_qty_in_cart[ $product_id ] + $quantity ) ) {
|
if ( isset( $product_qty_in_cart[ $product_id ] ) && ! $product_data->has_enough_stock( $product_qty_in_cart[ $product_id ] + $quantity ) ) {
|
||||||
wc_add_notice( sprintf(__( '<a href="%s" class="button wc-forward">%s</a> You cannot add that amount to the cart — we have %s in stock and you already have %s in your cart.', 'woocommerce' ), get_permalink( woocommerce_get_page_id( 'cart' ) ), __( 'View Cart', 'woocommerce' ), $product_data->get_stock_quantity(), $product_qty_in_cart[ $product_id ] ), 'error' );
|
wc_add_notice( sprintf(__( '<a href="%s" class="button wc-forward">%s</a> You cannot add that amount to the cart — we have %s in stock and you already have %s in your cart.', 'woocommerce' ), get_permalink( wc_get_page_id( 'cart' ) ), __( 'View Cart', 'woocommerce' ), $product_data->get_stock_quantity(), $product_qty_in_cart[ $product_id ] ), 'error' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1356,7 +1356,7 @@ class WC_Cart {
|
||||||
// Display varies depending on settings
|
// Display varies depending on settings
|
||||||
if ( $this->tax_display_cart == 'excl' ) {
|
if ( $this->tax_display_cart == 'excl' ) {
|
||||||
|
|
||||||
$return = woocommerce_price( $this->shipping_total );
|
$return = wc_price( $this->shipping_total );
|
||||||
|
|
||||||
if ( $this->shipping_tax_total > 0 && $this->prices_include_tax ) {
|
if ( $this->shipping_tax_total > 0 && $this->prices_include_tax ) {
|
||||||
$return .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$return .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
|
@ -1366,7 +1366,7 @@ class WC_Cart {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$return = woocommerce_price( $this->shipping_total + $this->shipping_tax_total );
|
$return = wc_price( $this->shipping_total + $this->shipping_tax_total );
|
||||||
|
|
||||||
if ( $this->shipping_tax_total > 0 && ! $this->prices_include_tax ) {
|
if ( $this->shipping_tax_total > 0 && ! $this->prices_include_tax ) {
|
||||||
$return .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
$return .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
||||||
|
@ -1839,7 +1839,7 @@ class WC_Cart {
|
||||||
* @return string formatted price
|
* @return string formatted price
|
||||||
*/
|
*/
|
||||||
public function get_total() {
|
public function get_total() {
|
||||||
return apply_filters( 'woocommerce_cart_total', woocommerce_price( $this->total ) );
|
return apply_filters( 'woocommerce_cart_total', wc_price( $this->total ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1851,7 +1851,7 @@ class WC_Cart {
|
||||||
$total = $this->total - $this->tax_total - $this->shipping_tax_total;
|
$total = $this->total - $this->tax_total - $this->shipping_tax_total;
|
||||||
if ( $total < 0 )
|
if ( $total < 0 )
|
||||||
$total = 0;
|
$total = 0;
|
||||||
return apply_filters( 'woocommerce_cart_total_ex_tax', woocommerce_price( $total ) );
|
return apply_filters( 'woocommerce_cart_total_ex_tax', wc_price( $total ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1861,9 +1861,9 @@ class WC_Cart {
|
||||||
*/
|
*/
|
||||||
public function get_cart_total() {
|
public function get_cart_total() {
|
||||||
if ( ! $this->prices_include_tax ) {
|
if ( ! $this->prices_include_tax ) {
|
||||||
$cart_contents_total = woocommerce_price( $this->cart_contents_total );
|
$cart_contents_total = wc_price( $this->cart_contents_total );
|
||||||
} else {
|
} else {
|
||||||
$cart_contents_total = woocommerce_price( $this->cart_contents_total + $this->tax_total );
|
$cart_contents_total = wc_price( $this->cart_contents_total + $this->tax_total );
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_cart_contents_total', $cart_contents_total );
|
return apply_filters( 'woocommerce_cart_contents_total', $cart_contents_total );
|
||||||
|
@ -1881,7 +1881,7 @@ class WC_Cart {
|
||||||
// cart + shipping + non-compound taxes (after discount)
|
// cart + shipping + non-compound taxes (after discount)
|
||||||
if ( $compound ) {
|
if ( $compound ) {
|
||||||
|
|
||||||
$cart_subtotal = woocommerce_price( $this->cart_contents_total + $this->shipping_total + $this->get_taxes_total( false, false ) );
|
$cart_subtotal = wc_price( $this->cart_contents_total + $this->shipping_total + $this->get_taxes_total( false, false ) );
|
||||||
|
|
||||||
// Otherwise we show cart items totals only (before discount)
|
// Otherwise we show cart items totals only (before discount)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1889,7 +1889,7 @@ class WC_Cart {
|
||||||
// Display varies depending on settings
|
// Display varies depending on settings
|
||||||
if ( $this->tax_display_cart == 'excl' ) {
|
if ( $this->tax_display_cart == 'excl' ) {
|
||||||
|
|
||||||
$cart_subtotal = woocommerce_price( $this->subtotal_ex_tax );
|
$cart_subtotal = wc_price( $this->subtotal_ex_tax );
|
||||||
|
|
||||||
if ( $this->tax_total > 0 && $this->prices_include_tax ) {
|
if ( $this->tax_total > 0 && $this->prices_include_tax ) {
|
||||||
$cart_subtotal .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$cart_subtotal .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
|
@ -1897,7 +1897,7 @@ class WC_Cart {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$cart_subtotal = woocommerce_price( $this->subtotal );
|
$cart_subtotal = wc_price( $this->subtotal );
|
||||||
|
|
||||||
if ( $this->tax_total > 0 && !$this->prices_include_tax ) {
|
if ( $this->tax_total > 0 && !$this->prices_include_tax ) {
|
||||||
$cart_subtotal .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
$cart_subtotal .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
||||||
|
@ -1921,7 +1921,7 @@ class WC_Cart {
|
||||||
else
|
else
|
||||||
$product_price = $_product->get_price_including_tax();
|
$product_price = $_product->get_price_including_tax();
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_cart_product_price', woocommerce_price( $product_price ), $_product );
|
return apply_filters( 'woocommerce_cart_product_price', wc_price( $product_price ), $_product );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1946,7 +1946,7 @@ class WC_Cart {
|
||||||
if ( $this->tax_display_cart == 'excl' ) {
|
if ( $this->tax_display_cart == 'excl' ) {
|
||||||
|
|
||||||
$row_price = $_product->get_price_excluding_tax( $quantity );
|
$row_price = $_product->get_price_excluding_tax( $quantity );
|
||||||
$product_subtotal = woocommerce_price( $row_price );
|
$product_subtotal = wc_price( $row_price );
|
||||||
|
|
||||||
if ( $this->prices_include_tax && $this->tax_total > 0 )
|
if ( $this->prices_include_tax && $this->tax_total > 0 )
|
||||||
$product_subtotal .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$product_subtotal .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
|
@ -1954,7 +1954,7 @@ class WC_Cart {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$row_price = $_product->get_price_including_tax( $quantity );
|
$row_price = $_product->get_price_including_tax( $quantity );
|
||||||
$product_subtotal = woocommerce_price( $row_price );
|
$product_subtotal = wc_price( $row_price );
|
||||||
|
|
||||||
if ( ! $this->prices_include_tax && $this->tax_total > 0 )
|
if ( ! $this->prices_include_tax && $this->tax_total > 0 )
|
||||||
$product_subtotal .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
|
$product_subtotal .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
|
||||||
|
@ -1965,7 +1965,7 @@ class WC_Cart {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$row_price = $price * $quantity;
|
$row_price = $price * $quantity;
|
||||||
$product_subtotal = woocommerce_price( $row_price );
|
$product_subtotal = wc_price( $row_price );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1978,9 +1978,9 @@ class WC_Cart {
|
||||||
* @return string formatted price
|
* @return string formatted price
|
||||||
*/
|
*/
|
||||||
public function get_cart_tax() {
|
public function get_cart_tax() {
|
||||||
$cart_total_tax = woocommerce_round_tax_total( $this->tax_total + $this->shipping_tax_total );
|
$cart_total_tax = wc_round_tax_total( $this->tax_total + $this->shipping_tax_total );
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_get_cart_tax', $cart_total_tax ? woocommerce_price( $cart_total_tax ) : '' );
|
return apply_filters( 'woocommerce_get_cart_tax', $cart_total_tax ? wc_price( $cart_total_tax ) : '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2000,7 +2000,7 @@ class WC_Cart {
|
||||||
$total += $tax;
|
$total += $tax;
|
||||||
}
|
}
|
||||||
if ( $display )
|
if ( $display )
|
||||||
return woocommerce_round_tax_total( $total );
|
return wc_round_tax_total( $total );
|
||||||
else
|
else
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
@ -2012,7 +2012,7 @@ class WC_Cart {
|
||||||
*/
|
*/
|
||||||
public function get_discounts_before_tax() {
|
public function get_discounts_before_tax() {
|
||||||
if ( $this->discount_cart ) {
|
if ( $this->discount_cart ) {
|
||||||
$discounts_before_tax = woocommerce_price( $this->discount_cart );
|
$discounts_before_tax = wc_price( $this->discount_cart );
|
||||||
} else {
|
} else {
|
||||||
$discounts_before_tax = false;
|
$discounts_before_tax = false;
|
||||||
}
|
}
|
||||||
|
@ -2026,7 +2026,7 @@ class WC_Cart {
|
||||||
*/
|
*/
|
||||||
public function get_discounts_after_tax() {
|
public function get_discounts_after_tax() {
|
||||||
if ( $this->discount_total ) {
|
if ( $this->discount_total ) {
|
||||||
$discounts_after_tax = woocommerce_price( $this->discount_total );
|
$discounts_after_tax = wc_price( $this->discount_total );
|
||||||
} else {
|
} else {
|
||||||
$discounts_after_tax = false;
|
$discounts_after_tax = false;
|
||||||
}
|
}
|
||||||
|
@ -2040,7 +2040,7 @@ class WC_Cart {
|
||||||
*/
|
*/
|
||||||
public function get_total_discount() {
|
public function get_total_discount() {
|
||||||
if ( $this->discount_total || $this->discount_cart ) {
|
if ( $this->discount_total || $this->discount_cart ) {
|
||||||
$total_discount = woocommerce_price( $this->discount_total + $this->discount_cart );
|
$total_discount = wc_price( $this->discount_total + $this->discount_cart );
|
||||||
} else {
|
} else {
|
||||||
$total_discount = false;
|
$total_discount = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ class WC_Checkout {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function checkout_form_billing() {
|
public function checkout_form_billing() {
|
||||||
woocommerce_get_template( 'checkout/form-billing.php', array( 'checkout' => $this ) );
|
wc_get_template( 'checkout/form-billing.php', array( 'checkout' => $this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class WC_Checkout {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function checkout_form_shipping() {
|
public function checkout_form_shipping() {
|
||||||
woocommerce_get_template( 'checkout/form-shipping.php', array( 'checkout' => $this ) );
|
wc_get_template( 'checkout/form-shipping.php', array( 'checkout' => $this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,30 +258,30 @@ class WC_Checkout {
|
||||||
$_product = $values['data'];
|
$_product = $values['data'];
|
||||||
|
|
||||||
// Add line item
|
// Add line item
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => $_product->get_title(),
|
'order_item_name' => $_product->get_title(),
|
||||||
'order_item_type' => 'line_item'
|
'order_item_type' => 'line_item'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $values['quantity'] ) );
|
wc_add_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $values['quantity'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_tax_class', $_product->get_tax_class() );
|
wc_add_order_item_meta( $item_id, '_tax_class', $_product->get_tax_class() );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_product_id', $values['product_id'] );
|
wc_add_order_item_meta( $item_id, '_product_id', $values['product_id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_variation_id', $values['variation_id'] );
|
wc_add_order_item_meta( $item_id, '_variation_id', $values['variation_id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_subtotal', woocommerce_format_decimal( $values['line_subtotal'] ) );
|
wc_add_order_item_meta( $item_id, '_line_subtotal', wc_format_decimal( $values['line_subtotal'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_total', woocommerce_format_decimal( $values['line_total'] ) );
|
wc_add_order_item_meta( $item_id, '_line_total', wc_format_decimal( $values['line_total'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_tax', woocommerce_format_decimal( $values['line_tax'] ) );
|
wc_add_order_item_meta( $item_id, '_line_tax', wc_format_decimal( $values['line_tax'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_subtotal_tax', woocommerce_format_decimal( $values['line_subtotal_tax'] ) );
|
wc_add_order_item_meta( $item_id, '_line_subtotal_tax', wc_format_decimal( $values['line_subtotal_tax'] ) );
|
||||||
|
|
||||||
// Store variation data in meta so admin can view it
|
// Store variation data in meta so admin can view it
|
||||||
if ( $values['variation'] && is_array( $values['variation'] ) )
|
if ( $values['variation'] && is_array( $values['variation'] ) )
|
||||||
foreach ( $values['variation'] as $key => $value )
|
foreach ( $values['variation'] as $key => $value )
|
||||||
woocommerce_add_order_item_meta( $item_id, esc_attr( str_replace( 'attribute_', '', $key ) ), $value );
|
wc_add_order_item_meta( $item_id, esc_attr( str_replace( 'attribute_', '', $key ) ), $value );
|
||||||
|
|
||||||
// Add line item meta for backorder status
|
// Add line item meta for backorder status
|
||||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $values['quantity'] ) )
|
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $values['quantity'] ) )
|
||||||
woocommerce_add_order_item_meta( $item_id, apply_filters( 'woocommerce_backordered_item_meta_name', __( 'Backordered', 'woocommerce' ), $cart_item_key, $order_id ), $values['quantity'] - max( 0, $_product->get_total_stock() ) );
|
wc_add_order_item_meta( $item_id, apply_filters( 'woocommerce_backordered_item_meta_name', __( 'Backordered', 'woocommerce' ), $cart_item_key, $order_id ), $values['quantity'] - max( 0, $_product->get_total_stock() ) );
|
||||||
|
|
||||||
// Allow plugins to add order item meta
|
// Allow plugins to add order item meta
|
||||||
do_action( 'woocommerce_add_order_item_meta', $item_id, $values, $cart_item_key );
|
do_action( 'woocommerce_add_order_item_meta', $item_id, $values, $cart_item_key );
|
||||||
|
@ -290,18 +290,18 @@ class WC_Checkout {
|
||||||
|
|
||||||
// Store fees
|
// Store fees
|
||||||
foreach ( WC()->cart->get_fees() as $fee ) {
|
foreach ( WC()->cart->get_fees() as $fee ) {
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => $fee->name,
|
'order_item_name' => $fee->name,
|
||||||
'order_item_type' => 'fee'
|
'order_item_type' => 'fee'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( $fee->taxable )
|
if ( $fee->taxable )
|
||||||
woocommerce_add_order_item_meta( $item_id, '_tax_class', $fee->tax_class );
|
wc_add_order_item_meta( $item_id, '_tax_class', $fee->tax_class );
|
||||||
else
|
else
|
||||||
woocommerce_add_order_item_meta( $item_id, '_tax_class', '0' );
|
wc_add_order_item_meta( $item_id, '_tax_class', '0' );
|
||||||
|
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_total', woocommerce_format_decimal( $fee->amount ) );
|
wc_add_order_item_meta( $item_id, '_line_total', wc_format_decimal( $fee->amount ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_tax', woocommerce_format_decimal( $fee->tax ) );
|
wc_add_order_item_meta( $item_id, '_line_tax', wc_format_decimal( $fee->tax ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store shipping for all packages
|
// Store shipping for all packages
|
||||||
|
@ -312,14 +312,14 @@ class WC_Checkout {
|
||||||
|
|
||||||
$method = $package['rates'][ $this->shipping_methods[ $i ] ];
|
$method = $package['rates'][ $this->shipping_methods[ $i ] ];
|
||||||
|
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => $method->label,
|
'order_item_name' => $method->label,
|
||||||
'order_item_type' => 'shipping'
|
'order_item_type' => 'shipping'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, 'method_id', $method->id );
|
wc_add_order_item_meta( $item_id, 'method_id', $method->id );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'cost', woocommerce_format_decimal( $method->cost ) );
|
wc_add_order_item_meta( $item_id, 'cost', wc_format_decimal( $method->cost ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,18 +327,18 @@ class WC_Checkout {
|
||||||
// Store tax rows
|
// Store tax rows
|
||||||
foreach ( array_keys( WC()->cart->taxes + WC()->cart->shipping_taxes ) as $key ) {
|
foreach ( array_keys( WC()->cart->taxes + WC()->cart->shipping_taxes ) as $key ) {
|
||||||
|
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => WC()->cart->tax->get_rate_code( $key ),
|
'order_item_name' => WC()->cart->tax->get_rate_code( $key ),
|
||||||
'order_item_type' => 'tax'
|
'order_item_type' => 'tax'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, 'rate_id', $key );
|
wc_add_order_item_meta( $item_id, 'rate_id', $key );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'label', WC()->cart->tax->get_rate_label( $key ) );
|
wc_add_order_item_meta( $item_id, 'label', WC()->cart->tax->get_rate_label( $key ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'compound', absint( WC()->cart->tax->is_compound( $key ) ? 1 : 0 ) );
|
wc_add_order_item_meta( $item_id, 'compound', absint( WC()->cart->tax->is_compound( $key ) ? 1 : 0 ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'tax_amount', woocommerce_format_decimal( isset( WC()->cart->taxes[ $key ] ) ? WC()->cart->taxes[ $key ] : 0 ) );
|
wc_add_order_item_meta( $item_id, 'tax_amount', wc_format_decimal( isset( WC()->cart->taxes[ $key ] ) ? WC()->cart->taxes[ $key ] : 0 ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'shipping_tax_amount', woocommerce_format_decimal( isset( WC()->cart->shipping_taxes[ $key ] ) ? WC()->cart->shipping_taxes[ $key ] : 0 ) );
|
wc_add_order_item_meta( $item_id, 'shipping_tax_amount', wc_format_decimal( isset( WC()->cart->shipping_taxes[ $key ] ) ? WC()->cart->shipping_taxes[ $key ] : 0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,14 +346,14 @@ class WC_Checkout {
|
||||||
if ( $applied_coupons = WC()->cart->get_coupons() ) {
|
if ( $applied_coupons = WC()->cart->get_coupons() ) {
|
||||||
foreach ( $applied_coupons as $code => $coupon ) {
|
foreach ( $applied_coupons as $code => $coupon ) {
|
||||||
|
|
||||||
$item_id = woocommerce_add_order_item( $order_id, array(
|
$item_id = wc_add_order_item( $order_id, array(
|
||||||
'order_item_name' => $code,
|
'order_item_name' => $code,
|
||||||
'order_item_type' => 'coupon'
|
'order_item_type' => 'coupon'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, 'discount_amount', isset( WC()->cart->coupon_discount_amounts[ $code ] ) ? WC()->cart->coupon_discount_amounts[ $code ] : 0 );
|
wc_add_order_item_meta( $item_id, 'discount_amount', isset( WC()->cart->coupon_discount_amounts[ $code ] ) ? WC()->cart->coupon_discount_amounts[ $code ] : 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,12 +362,12 @@ class WC_Checkout {
|
||||||
update_post_meta( $order_id, '_payment_method', $this->payment_method->id );
|
update_post_meta( $order_id, '_payment_method', $this->payment_method->id );
|
||||||
update_post_meta( $order_id, '_payment_method_title', $this->payment_method->get_title() );
|
update_post_meta( $order_id, '_payment_method_title', $this->payment_method->get_title() );
|
||||||
}
|
}
|
||||||
update_post_meta( $order_id, '_order_shipping', woocommerce_format_decimal( WC()->cart->shipping_total ) );
|
update_post_meta( $order_id, '_order_shipping', wc_format_decimal( WC()->cart->shipping_total ) );
|
||||||
update_post_meta( $order_id, '_order_discount', woocommerce_format_decimal( WC()->cart->get_order_discount_total() ) );
|
update_post_meta( $order_id, '_order_discount', wc_format_decimal( WC()->cart->get_order_discount_total() ) );
|
||||||
update_post_meta( $order_id, '_cart_discount', woocommerce_format_decimal( WC()->cart->get_cart_discount_total() ) );
|
update_post_meta( $order_id, '_cart_discount', wc_format_decimal( WC()->cart->get_cart_discount_total() ) );
|
||||||
update_post_meta( $order_id, '_order_tax', woocommerce_format_decimal( woocommerce_round_tax_total( WC()->cart->tax_total ) ) );
|
update_post_meta( $order_id, '_order_tax', wc_format_decimal( wc_round_tax_total( WC()->cart->tax_total ) ) );
|
||||||
update_post_meta( $order_id, '_order_shipping_tax', woocommerce_format_decimal( woocommerce_round_tax_total( WC()->cart->shipping_tax_total ) ) );
|
update_post_meta( $order_id, '_order_shipping_tax', wc_format_decimal( wc_round_tax_total( WC()->cart->shipping_tax_total ) ) );
|
||||||
update_post_meta( $order_id, '_order_total', woocommerce_format_decimal( WC()->cart->total, get_option( 'woocommerce_price_num_decimals' ) ) );
|
update_post_meta( $order_id, '_order_total', wc_format_decimal( WC()->cart->total, get_option( 'woocommerce_price_num_decimals' ) ) );
|
||||||
|
|
||||||
update_post_meta( $order_id, '_order_key', 'wc_' . apply_filters('woocommerce_generate_order_key', uniqid('order_') ) );
|
update_post_meta( $order_id, '_order_key', 'wc_' . apply_filters('woocommerce_generate_order_key', uniqid('order_') ) );
|
||||||
update_post_meta( $order_id, '_customer_user', absint( $this->customer_id ) );
|
update_post_meta( $order_id, '_customer_user', absint( $this->customer_id ) );
|
||||||
|
@ -431,7 +431,7 @@ class WC_Checkout {
|
||||||
|
|
||||||
if ( isset( $this->posted['shipping_method'] ) && is_array( $this->posted['shipping_method'] ) )
|
if ( isset( $this->posted['shipping_method'] ) && is_array( $this->posted['shipping_method'] ) )
|
||||||
foreach ( $this->posted['shipping_method'] as $i => $value )
|
foreach ( $this->posted['shipping_method'] as $i => $value )
|
||||||
$chosen_shipping_methods[ $i ] = woocommerce_clean( $value );
|
$chosen_shipping_methods[ $i ] = wc_clean( $value );
|
||||||
|
|
||||||
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
||||||
WC()->session->set( 'chosen_payment_method', $this->posted['payment_method'] );
|
WC()->session->set( 'chosen_payment_method', $this->posted['payment_method'] );
|
||||||
|
@ -464,13 +464,13 @@ class WC_Checkout {
|
||||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? 1 : 0;
|
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
case "multiselect" :
|
case "multiselect" :
|
||||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? implode( ', ', array_map( 'woocommerce_clean', $_POST[ $key ] ) ) : '';
|
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? implode( ', ', array_map( 'wc_clean', $_POST[ $key ] ) ) : '';
|
||||||
break;
|
break;
|
||||||
case "textarea" :
|
case "textarea" :
|
||||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? wp_strip_all_tags( wp_check_invalid_utf8( stripslashes( $_POST[ $key ] ) ) ) : '';
|
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? wp_strip_all_tags( wp_check_invalid_utf8( stripslashes( $_POST[ $key ] ) ) ) : '';
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? woocommerce_clean( $_POST[ $key ] ) : '';
|
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ class WC_Checkout {
|
||||||
WC()->cart->calculate_totals();
|
WC()->cart->calculate_totals();
|
||||||
|
|
||||||
// Terms
|
// Terms
|
||||||
if ( ! isset( $_POST['woocommerce_checkout_update_totals'] ) && empty( $this->posted['terms'] ) && woocommerce_get_page_id( 'terms' ) > 0 )
|
if ( ! isset( $_POST['woocommerce_checkout_update_totals'] ) && empty( $this->posted['terms'] ) && wc_get_page_id( 'terms' ) > 0 )
|
||||||
wc_add_notice( __( 'You must accept our Terms & Conditions.', 'woocommerce' ), 'error' );
|
wc_add_notice( __( 'You must accept our Terms & Conditions.', 'woocommerce' ), 'error' );
|
||||||
|
|
||||||
if ( WC()->cart->needs_shipping() ) {
|
if ( WC()->cart->needs_shipping() ) {
|
||||||
|
@ -614,14 +614,14 @@ class WC_Checkout {
|
||||||
|
|
||||||
$username = ! empty( $this->posted['account_username'] ) ? $this->posted['account_username'] : '';
|
$username = ! empty( $this->posted['account_username'] ) ? $this->posted['account_username'] : '';
|
||||||
$password = ! empty( $this->posted['account_password'] ) ? $this->posted['account_password'] : '';
|
$password = ! empty( $this->posted['account_password'] ) ? $this->posted['account_password'] : '';
|
||||||
$new_customer = woocommerce_create_new_customer( $this->posted['billing_email'], $username, $password );
|
$new_customer = wc_create_new_customer( $this->posted['billing_email'], $username, $password );
|
||||||
|
|
||||||
if ( is_wp_error( $new_customer ) )
|
if ( is_wp_error( $new_customer ) )
|
||||||
throw new Exception( $new_customer->get_error_message() );
|
throw new Exception( $new_customer->get_error_message() );
|
||||||
|
|
||||||
$this->customer_id = $new_customer;
|
$this->customer_id = $new_customer;
|
||||||
|
|
||||||
woocommerce_set_customer_auth_cookie( $this->customer_id );
|
wc_set_customer_auth_cookie( $this->customer_id );
|
||||||
|
|
||||||
// As we are now logged in, checkout will need to refresh to show logged in data
|
// As we are now logged in, checkout will need to refresh to show logged in data
|
||||||
WC()->session->set( 'reload_checkout', true );
|
WC()->session->set( 'reload_checkout', true );
|
||||||
|
@ -742,7 +742,7 @@ class WC_Checkout {
|
||||||
public function get_value( $input ) {
|
public function get_value( $input ) {
|
||||||
if ( ! empty( $_POST[ $input ] ) ) {
|
if ( ! empty( $_POST[ $input ] ) ) {
|
||||||
|
|
||||||
return woocommerce_clean( $_POST[ $input ] );
|
return wc_clean( $_POST[ $input ] );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ class WC_Countries {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_base_state() {
|
public function get_base_state() {
|
||||||
$default = woocommerce_clean( get_option( 'woocommerce_default_country' ) );
|
$default = wc_clean( get_option( 'woocommerce_default_country' ) );
|
||||||
$state = ( ( $pos = strrpos( $default, ':' ) ) === false ) ? '' : substr( $default, $pos + 1 );
|
$state = ( ( $pos = strrpos( $default, ':' ) ) === false ) ? '' : substr( $default, $pos + 1 );
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_countries_base_state', $state );
|
return apply_filters( 'woocommerce_countries_base_state', $state );
|
||||||
|
@ -1104,7 +1104,7 @@ class WC_Countries {
|
||||||
|
|
||||||
if ( isset( $locale[ $country ] ) ) {
|
if ( isset( $locale[ $country ] ) ) {
|
||||||
|
|
||||||
$fields = woocommerce_array_overlay( $fields, $locale[ $country ] );
|
$fields = wc_array_overlay( $fields, $locale[ $country ] );
|
||||||
|
|
||||||
// If default country has postcode_before_city switch the fields round.
|
// If default country has postcode_before_city switch the fields round.
|
||||||
// This is only done at this point, not if country changes on checkout.
|
// This is only done at this point, not if country changes on checkout.
|
||||||
|
|
|
@ -609,7 +609,7 @@ class WC_Coupon {
|
||||||
$err = __( 'This coupon has expired.', 'woocommerce' );
|
$err = __( 'This coupon has expired.', 'woocommerce' );
|
||||||
break;
|
break;
|
||||||
case self::E_WC_COUPON_MIN_SPEND_LIMIT_NOT_MET:
|
case self::E_WC_COUPON_MIN_SPEND_LIMIT_NOT_MET:
|
||||||
$err = sprintf( __( 'The minimum spend for this coupon is %s.', 'woocommerce' ), woocommerce_price( $this->minimum_amount ) );
|
$err = sprintf( __( 'The minimum spend for this coupon is %s.', 'woocommerce' ), wc_price( $this->minimum_amount ) );
|
||||||
break;
|
break;
|
||||||
case self::E_WC_COUPON_NOT_APPLICABLE:
|
case self::E_WC_COUPON_NOT_APPLICABLE:
|
||||||
$err = __( 'Sorry, this coupon is not applicable to your cart contents.', 'woocommerce' );
|
$err = __( 'Sorry, this coupon is not applicable to your cart contents.', 'woocommerce' );
|
||||||
|
|
|
@ -70,7 +70,7 @@ class WC_Download_Handler {
|
||||||
if ( $user_id && get_option( 'woocommerce_downloads_require_login' ) == 'yes' ) {
|
if ( $user_id && get_option( 'woocommerce_downloads_require_login' ) == 'yes' ) {
|
||||||
|
|
||||||
if ( ! is_user_logged_in() )
|
if ( ! is_user_logged_in() )
|
||||||
wp_die( __( 'You must be logged in to download files.', 'woocommerce' ) . ' <a href="' . wp_login_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) . '">' . __( 'Login →', 'woocommerce' ) . '</a>', __( 'Log in to Download Files', 'woocommerce' ) );
|
wp_die( __( 'You must be logged in to download files.', 'woocommerce' ) . ' <a href="' . wp_login_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) . '">' . __( 'Login →', 'woocommerce' ) . '</a>', __( 'Log in to Download Files', 'woocommerce' ) );
|
||||||
|
|
||||||
elseif ( !current_user_can( 'download_file', $download_result ) )
|
elseif ( !current_user_can( 'download_file', $download_result ) )
|
||||||
wp_die( __( 'This is not your download link.', 'woocommerce' ) );
|
wp_die( __( 'This is not your download link.', 'woocommerce' ) );
|
||||||
|
|
|
@ -173,7 +173,7 @@ class WC_Emails {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function email_header( $email_heading ) {
|
function email_header( $email_heading ) {
|
||||||
woocommerce_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) );
|
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +183,7 @@ class WC_Emails {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function email_footer() {
|
function email_footer() {
|
||||||
woocommerce_get_template( 'emails/email-footer.php' );
|
wc_get_template( 'emails/email-footer.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,7 +70,7 @@ class WC_Form_Handler {
|
||||||
$_POST[ $key ] = isset( $_POST[ $key ] ) ? 1 : 0;
|
$_POST[ $key ] = isset( $_POST[ $key ] ) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
$_POST[ $key ] = isset( $_POST[ $key ] ) ? woocommerce_clean( $_POST[ $key ] ) : '';
|
$_POST[ $key ] = isset( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
do_action( 'woocommerce_customer_save_address', $user_id, $load_address );
|
do_action( 'woocommerce_customer_save_address', $user_id, $load_address );
|
||||||
|
|
||||||
wp_safe_redirect( get_permalink( woocommerce_get_page_id('myaccount') ) );
|
wp_safe_redirect( get_permalink( wc_get_page_id('myaccount') ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,11 +148,11 @@ class WC_Form_Handler {
|
||||||
if ( $user->ID <= 0 )
|
if ( $user->ID <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$account_first_name = ! empty( $_POST[ 'account_first_name' ] ) ? woocommerce_clean( $_POST[ 'account_first_name' ] ) : '';
|
$account_first_name = ! empty( $_POST[ 'account_first_name' ] ) ? wc_clean( $_POST[ 'account_first_name' ] ) : '';
|
||||||
$account_last_name = ! empty( $_POST[ 'account_last_name' ] ) ? woocommerce_clean( $_POST[ 'account_last_name' ] ) : '';
|
$account_last_name = ! empty( $_POST[ 'account_last_name' ] ) ? wc_clean( $_POST[ 'account_last_name' ] ) : '';
|
||||||
$account_email = ! empty( $_POST[ 'account_email' ] ) ? woocommerce_clean( $_POST[ 'account_email' ] ) : '';
|
$account_email = ! empty( $_POST[ 'account_email' ] ) ? wc_clean( $_POST[ 'account_email' ] ) : '';
|
||||||
$pass1 = ! empty( $_POST[ 'password_1' ] ) ? woocommerce_clean( $_POST[ 'password_1' ] ) : '';
|
$pass1 = ! empty( $_POST[ 'password_1' ] ) ? wc_clean( $_POST[ 'password_1' ] ) : '';
|
||||||
$pass2 = ! empty( $_POST[ 'password_2' ] ) ? woocommerce_clean( $_POST[ 'password_2' ] ) : '';
|
$pass2 = ! empty( $_POST[ 'password_2' ] ) ? wc_clean( $_POST[ 'password_2' ] ) : '';
|
||||||
|
|
||||||
$user->first_name = $account_first_name;
|
$user->first_name = $account_first_name;
|
||||||
$user->last_name = $account_last_name;
|
$user->last_name = $account_last_name;
|
||||||
|
@ -192,7 +192,7 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
do_action( 'woocommerce_save_account_details', $user->ID );
|
do_action( 'woocommerce_save_account_details', $user->ID );
|
||||||
|
|
||||||
wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ class WC_Form_Handler {
|
||||||
if ( isset( $_POST['woocommerce_checkout_place_order'] ) || isset( $_POST['woocommerce_checkout_update_totals'] ) ) {
|
if ( isset( $_POST['woocommerce_checkout_place_order'] ) || isset( $_POST['woocommerce_checkout_update_totals'] ) ) {
|
||||||
|
|
||||||
if ( sizeof( WC()->cart->get_cart() ) == 0 ) {
|
if ( sizeof( WC()->cart->get_cart() ) == 0 ) {
|
||||||
wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) );
|
wp_redirect( get_permalink( wc_get_page_id( 'cart' ) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
// Update payment method
|
// Update payment method
|
||||||
if ( $order->needs_payment() ) {
|
if ( $order->needs_payment() ) {
|
||||||
$payment_method = woocommerce_clean( $_POST['payment_method'] );
|
$payment_method = wc_clean( $_POST['payment_method'] );
|
||||||
|
|
||||||
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$payment_method = woocommerce_clean( $_POST['payment_method'] );
|
$payment_method = wc_clean( $_POST['payment_method'] );
|
||||||
|
|
||||||
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
@ -526,7 +526,7 @@ class WC_Form_Handler {
|
||||||
if ( isset( $_REQUEST[ $taxonomy ] ) ) {
|
if ( isset( $_REQUEST[ $taxonomy ] ) ) {
|
||||||
|
|
||||||
// Get value from post data
|
// Get value from post data
|
||||||
// Don't use woocommerce_clean as it destroys sanitized characters
|
// Don't use wc_clean as it destroys sanitized characters
|
||||||
$value = sanitize_title( trim( stripslashes( $_REQUEST[ $taxonomy ] ) ) );
|
$value = sanitize_title( trim( stripslashes( $_REQUEST[ $taxonomy ] ) ) );
|
||||||
|
|
||||||
// Get valid value from variation
|
// Get valid value from variation
|
||||||
|
@ -561,7 +561,7 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
if ( $passed_validation ) {
|
if ( $passed_validation ) {
|
||||||
if ( WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations ) ) {
|
if ( WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations ) ) {
|
||||||
woocommerce_add_to_cart_message( $product_id );
|
wc_add_to_cart_message( $product_id );
|
||||||
$was_added_to_cart = true;
|
$was_added_to_cart = true;
|
||||||
$added_to_cart[] = $product_id;
|
$added_to_cart[] = $product_id;
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ class WC_Form_Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $was_added_to_cart ) {
|
if ( $was_added_to_cart ) {
|
||||||
woocommerce_add_to_cart_message( $added_to_cart );
|
wc_add_to_cart_message( $added_to_cart );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $was_added_to_cart && ! $quantity_set ) {
|
if ( ! $was_added_to_cart && ! $quantity_set ) {
|
||||||
|
@ -623,7 +623,7 @@ class WC_Form_Handler {
|
||||||
if ( $passed_validation ) {
|
if ( $passed_validation ) {
|
||||||
// Add the product to the cart
|
// Add the product to the cart
|
||||||
if ( WC()->cart->add_to_cart( $product_id, $quantity ) ) {
|
if ( WC()->cart->add_to_cart( $product_id, $quantity ) ) {
|
||||||
woocommerce_add_to_cart_message( $product_id );
|
wc_add_to_cart_message( $product_id );
|
||||||
$was_added_to_cart = true;
|
$was_added_to_cart = true;
|
||||||
$added_to_cart[] = $product_id;
|
$added_to_cart[] = $product_id;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +700,7 @@ class WC_Form_Handler {
|
||||||
} elseif ( wp_get_referer() ) {
|
} elseif ( wp_get_referer() ) {
|
||||||
$redirect = esc_url( wp_get_referer() );
|
$redirect = esc_url( wp_get_referer() );
|
||||||
} else {
|
} else {
|
||||||
$redirect = esc_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
$redirect = esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feedback
|
// Feedback
|
||||||
|
@ -740,8 +740,8 @@ class WC_Form_Handler {
|
||||||
if ( is_object( $user ) ) {
|
if ( is_object( $user ) ) {
|
||||||
|
|
||||||
// save these values into the form again in case of errors
|
// save these values into the form again in case of errors
|
||||||
$args['key'] = woocommerce_clean( $_POST['reset_key'] );
|
$args['key'] = wc_clean( $_POST['reset_key'] );
|
||||||
$args['login'] = woocommerce_clean( $_POST['reset_login'] );
|
$args['login'] = wc_clean( $_POST['reset_login'] );
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-reset_password' );
|
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-reset_password' );
|
||||||
|
|
||||||
|
@ -763,11 +763,11 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
if( 0 == wc_notice_count( 'wc_errors' ) ) {
|
if( 0 == wc_notice_count( 'wc_errors' ) ) {
|
||||||
|
|
||||||
WC_Shortcode_My_Account::reset_password( $user, woocommerce_clean( $_POST['password_1'] ) );
|
WC_Shortcode_My_Account::reset_password( $user, wc_clean( $_POST['password_1'] ) );
|
||||||
|
|
||||||
do_action( 'woocommerce_customer_reset_password', $user );
|
do_action( 'woocommerce_customer_reset_password', $user );
|
||||||
|
|
||||||
wc_add_notice( __( 'Your password has been reset.', 'woocommerce' ) . ' <a href="' . get_permalink( woocommerce_get_page_id( 'myaccount' ) ) . '">' . __( 'Log in', 'woocommerce' ) . '</a>' );
|
wc_add_notice( __( 'Your password has been reset.', 'woocommerce' ) . ' <a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">' . __( 'Log in', 'woocommerce' ) . '</a>' );
|
||||||
|
|
||||||
wp_redirect( remove_query_arg( array( 'key', 'login' ) ) );
|
wp_redirect( remove_query_arg( array( 'key', 'login' ) ) );
|
||||||
exit;
|
exit;
|
||||||
|
@ -785,9 +785,9 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
WC()->verify_nonce( 'register' );
|
WC()->verify_nonce( 'register' );
|
||||||
|
|
||||||
$username = ! empty( $_POST['username'] ) ? woocommerce_clean( $_POST['username'] ) : '';
|
$username = ! empty( $_POST['username'] ) ? wc_clean( $_POST['username'] ) : '';
|
||||||
$email = ! empty( $_POST['email'] ) ? woocommerce_clean( $_POST['email'] ) : '';
|
$email = ! empty( $_POST['email'] ) ? wc_clean( $_POST['email'] ) : '';
|
||||||
$password = ! empty( $_POST['password'] ) ? woocommerce_clean( $_POST['password'] ) : '';
|
$password = ! empty( $_POST['password'] ) ? wc_clean( $_POST['password'] ) : '';
|
||||||
|
|
||||||
// Anti-spam trap
|
// Anti-spam trap
|
||||||
if ( ! empty( $_POST['email_2'] ) ) {
|
if ( ! empty( $_POST['email_2'] ) ) {
|
||||||
|
@ -795,20 +795,20 @@ class WC_Form_Handler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_customer = woocommerce_create_new_customer( $email, $username, $password );
|
$new_customer = wc_create_new_customer( $email, $username, $password );
|
||||||
|
|
||||||
if ( is_wp_error( $new_customer ) ) {
|
if ( is_wp_error( $new_customer ) ) {
|
||||||
wc_add_notice( $new_customer->get_error_message(), 'error' );
|
wc_add_notice( $new_customer->get_error_message(), 'error' );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
woocommerce_set_customer_auth_cookie( $new_customer );
|
wc_set_customer_auth_cookie( $new_customer );
|
||||||
|
|
||||||
// Redirect
|
// Redirect
|
||||||
if ( wp_get_referer() ) {
|
if ( wp_get_referer() ) {
|
||||||
$redirect = esc_url( wp_get_referer() );
|
$redirect = esc_url( wp_get_referer() );
|
||||||
} else {
|
} else {
|
||||||
$redirect = esc_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
$redirect = esc_url( get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_redirect( apply_filters( 'woocommerce_registration_redirect', $redirect ) );
|
wp_redirect( apply_filters( 'woocommerce_registration_redirect', $redirect ) );
|
||||||
|
|
|
@ -118,7 +118,7 @@ class WC_Frontend_Scripts {
|
||||||
'apply_coupon_nonce' => wp_create_nonce( "apply-coupon" ),
|
'apply_coupon_nonce' => wp_create_nonce( "apply-coupon" ),
|
||||||
'option_guest_checkout' => get_option( 'woocommerce_enable_guest_checkout' ),
|
'option_guest_checkout' => get_option( 'woocommerce_enable_guest_checkout' ),
|
||||||
'checkout_url' => add_query_arg( 'action', 'woocommerce_checkout', WC()->ajax_url() ),
|
'checkout_url' => add_query_arg( 'action', 'woocommerce_checkout', WC()->ajax_url() ),
|
||||||
'is_checkout' => is_page( woocommerce_get_page_id( 'checkout' ) ) && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ? 1 : 0,
|
'is_checkout' => is_page( wc_get_page_id( 'checkout' ) ) && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ? 1 : 0,
|
||||||
'locale' => json_encode( WC()->countries->get_country_locale() )
|
'locale' => json_encode( WC()->countries->get_country_locale() )
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class WC_Frontend_Scripts {
|
||||||
'ajax_url' => WC()->ajax_url(),
|
'ajax_url' => WC()->ajax_url(),
|
||||||
'ajax_loader_url' => apply_filters( 'woocommerce_ajax_loader_url', $assets_path . 'images/ajax-loader@2x.gif' ),
|
'ajax_loader_url' => apply_filters( 'woocommerce_ajax_loader_url', $assets_path . 'images/ajax-loader@2x.gif' ),
|
||||||
'i18n_view_cart' => esc_attr__( 'View Cart', 'woocommerce' ),
|
'i18n_view_cart' => esc_attr__( 'View Cart', 'woocommerce' ),
|
||||||
'cart_url' => get_permalink( woocommerce_get_page_id( 'cart' ) ),
|
'cart_url' => get_permalink( wc_get_page_id( 'cart' ) ),
|
||||||
'is_cart' => is_cart(),
|
'is_cart' => is_cart(),
|
||||||
'cart_redirect_after_add' => get_option( 'woocommerce_cart_redirect_after_add' )
|
'cart_redirect_after_add' => get_option( 'woocommerce_cart_redirect_after_add' )
|
||||||
) ) );
|
) ) );
|
||||||
|
|
|
@ -121,7 +121,7 @@ class WC_Install {
|
||||||
update_option( 'woocommerce_version', WC()->version );
|
update_option( 'woocommerce_version', WC()->version );
|
||||||
|
|
||||||
// Check if pages are needed
|
// Check if pages are needed
|
||||||
if ( woocommerce_get_page_id( 'shop' ) < 1 )
|
if ( wc_get_page_id( 'shop' ) < 1 )
|
||||||
update_option( '_wc_needs_pages', 1 );
|
update_option( '_wc_needs_pages', 1 );
|
||||||
|
|
||||||
// Flush rewrite rules
|
// Flush rewrite rules
|
||||||
|
@ -228,7 +228,7 @@ class WC_Install {
|
||||||
) );
|
) );
|
||||||
|
|
||||||
foreach ( $pages as $key => $page )
|
foreach ( $pages as $key => $page )
|
||||||
wc_create_page( esc_sql( $page['name'] ), 'woocommerce_' . $key . '_page_id', $page['title'], $page['content'], ! empty( $page['parent'] ) ? woocommerce_get_page_id( $page['parent'] ) : '' );
|
wc_create_page( esc_sql( $page['name'] ), 'woocommerce_' . $key . '_page_id', $page['title'], $page['content'], ! empty( $page['parent'] ) ? wc_get_page_id( $page['parent'] ) : '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -382,7 +382,7 @@ class WC_Order {
|
||||||
$tax_totals[ $code ]->is_compound = $tax[ 'compound' ];
|
$tax_totals[ $code ]->is_compound = $tax[ 'compound' ];
|
||||||
$tax_totals[ $code ]->label = isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ];
|
$tax_totals[ $code ]->label = isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ];
|
||||||
$tax_totals[ $code ]->amount += $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ];
|
$tax_totals[ $code ]->amount += $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ];
|
||||||
$tax_totals[ $code ]->formatted_amount = woocommerce_price( woocommerce_round_tax_total( $tax_totals[ $code ]->amount ) );
|
$tax_totals[ $code ]->formatted_amount = wc_price( wc_round_tax_total( $tax_totals[ $code ]->amount ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_order_tax_totals', $tax_totals, $this );
|
return apply_filters( 'woocommerce_order_tax_totals', $tax_totals, $this );
|
||||||
|
@ -474,7 +474,7 @@ class WC_Order {
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_total_tax() {
|
public function get_total_tax() {
|
||||||
return apply_filters( 'woocommerce_order_amount_total_tax', woocommerce_round_tax_total( $this->get_cart_tax() + $this->get_shipping_tax() ), $this );
|
return apply_filters( 'woocommerce_order_amount_total_tax', wc_round_tax_total( $this->get_cart_tax() + $this->get_shipping_tax() ), $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -580,7 +580,7 @@ class WC_Order {
|
||||||
*/
|
*/
|
||||||
public function get_item_tax( $item, $round = true ) {
|
public function get_item_tax( $item, $round = true ) {
|
||||||
$price = $item['line_tax'] / $item['qty'];
|
$price = $item['line_tax'] / $item['qty'];
|
||||||
$price = $round ? woocommerce_round_tax_total( $price ) : $price;
|
$price = $round ? wc_round_tax_total( $price ) : $price;
|
||||||
return apply_filters( 'woocommerce_order_amount_item_tax', $price, $item, $round, $this );
|
return apply_filters( 'woocommerce_order_amount_item_tax', $price, $item, $round, $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,7 +592,7 @@ class WC_Order {
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function get_line_tax( $item ) {
|
public function get_line_tax( $item ) {
|
||||||
return apply_filters( 'woocommerce_order_amount_line_tax', woocommerce_round_tax_total( $item['line_tax'] ), $item, $this );
|
return apply_filters( 'woocommerce_order_amount_line_tax', wc_round_tax_total( $item['line_tax'] ), $item, $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -661,9 +661,9 @@ class WC_Order {
|
||||||
if ( $tax_display == 'excl' ) {
|
if ( $tax_display == 'excl' ) {
|
||||||
$ex_tax_label = $this->prices_include_tax ? 1 : 0;
|
$ex_tax_label = $this->prices_include_tax ? 1 : 0;
|
||||||
|
|
||||||
$subtotal = woocommerce_price( $this->get_line_subtotal( $item ), array( 'ex_tax_label' => $ex_tax_label ) );
|
$subtotal = wc_price( $this->get_line_subtotal( $item ), array( 'ex_tax_label' => $ex_tax_label ) );
|
||||||
} else {
|
} else {
|
||||||
$subtotal = woocommerce_price( $this->get_line_subtotal( $item, true ) );
|
$subtotal = wc_price( $this->get_line_subtotal( $item, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_order_formatted_line_subtotal', $subtotal, $item, $this );
|
return apply_filters( 'woocommerce_order_formatted_line_subtotal', $subtotal, $item, $this );
|
||||||
|
@ -690,7 +690,7 @@ class WC_Order {
|
||||||
*/
|
*/
|
||||||
public function get_formatted_order_total() {
|
public function get_formatted_order_total() {
|
||||||
|
|
||||||
$formatted_total = woocommerce_price( $this->order_total , array('currency' => $this->get_order_currency()));
|
$formatted_total = wc_price( $this->order_total , array('currency' => $this->get_order_currency()));
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this );
|
return apply_filters( 'woocommerce_get_formatted_order_total', $formatted_total, $this );
|
||||||
}
|
}
|
||||||
|
@ -722,7 +722,7 @@ class WC_Order {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$subtotal = woocommerce_price( $subtotal );
|
$subtotal = wc_price( $subtotal );
|
||||||
|
|
||||||
if ( $tax_display == 'excl' && $this->prices_include_tax )
|
if ( $tax_display == 'excl' && $this->prices_include_tax )
|
||||||
$subtotal .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$subtotal .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
|
@ -753,7 +753,7 @@ class WC_Order {
|
||||||
// Remove discounts
|
// Remove discounts
|
||||||
$subtotal = $subtotal - $this->get_cart_discount();
|
$subtotal = $subtotal - $this->get_cart_discount();
|
||||||
|
|
||||||
$subtotal = woocommerce_price( $subtotal );
|
$subtotal = wc_price( $subtotal );
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_order_subtotal_to_display', $subtotal, $compound, $this );
|
return apply_filters( 'woocommerce_order_subtotal_to_display', $subtotal, $compound, $this );
|
||||||
|
@ -777,7 +777,7 @@ class WC_Order {
|
||||||
if ( $tax_display == 'excl' ) {
|
if ( $tax_display == 'excl' ) {
|
||||||
|
|
||||||
// Show shipping excluding tax
|
// Show shipping excluding tax
|
||||||
$shipping = woocommerce_price( $this->order_shipping );
|
$shipping = wc_price( $this->order_shipping );
|
||||||
|
|
||||||
if ( $this->order_shipping_tax > 0 && $this->prices_include_tax )
|
if ( $this->order_shipping_tax > 0 && $this->prices_include_tax )
|
||||||
$tax_text = WC()->countries->ex_tax_or_vat() . ' ';
|
$tax_text = WC()->countries->ex_tax_or_vat() . ' ';
|
||||||
|
@ -785,7 +785,7 @@ class WC_Order {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Show shipping including tax
|
// Show shipping including tax
|
||||||
$shipping = woocommerce_price( $this->order_shipping + $this->order_shipping_tax );
|
$shipping = wc_price( $this->order_shipping + $this->order_shipping_tax );
|
||||||
|
|
||||||
if ( $this->order_shipping_tax > 0 && ! $this->prices_include_tax )
|
if ( $this->order_shipping_tax > 0 && ! $this->prices_include_tax )
|
||||||
$tax_text = WC()->countries->inc_tax_or_vat() . ' ';
|
$tax_text = WC()->countries->inc_tax_or_vat() . ' ';
|
||||||
|
@ -811,7 +811,7 @@ class WC_Order {
|
||||||
* @return string.
|
* @return string.
|
||||||
*/
|
*/
|
||||||
public function get_cart_discount_to_display() {
|
public function get_cart_discount_to_display() {
|
||||||
return apply_filters( 'woocommerce_order_cart_discount_to_display', woocommerce_price( $this->get_cart_discount() ), $this );
|
return apply_filters( 'woocommerce_order_cart_discount_to_display', wc_price( $this->get_cart_discount() ), $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ class WC_Order {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_order_discount_to_display() {
|
public function get_order_discount_to_display() {
|
||||||
return apply_filters( 'woocommerce_order_discount_to_display', woocommerce_price( $this->get_order_discount() ), $this );
|
return apply_filters( 'woocommerce_order_discount_to_display', wc_price( $this->get_order_discount() ), $this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -878,14 +878,14 @@ class WC_Order {
|
||||||
|
|
||||||
$total_rows[ 'fee_' . $id ] = array(
|
$total_rows[ 'fee_' . $id ] = array(
|
||||||
'label' => $fee['name'],
|
'label' => $fee['name'],
|
||||||
'value' => woocommerce_price( $fee['line_total'] )
|
'value' => wc_price( $fee['line_total'] )
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$total_rows[ 'fee_' . $id ] = array(
|
$total_rows[ 'fee_' . $id ] = array(
|
||||||
'label' => $fee['name'],
|
'label' => $fee['name'],
|
||||||
'value' => woocommerce_price( $fee['line_total'] + $fee['line_tax'] )
|
'value' => wc_price( $fee['line_total'] + $fee['line_tax'] )
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -903,7 +903,7 @@ class WC_Order {
|
||||||
} else {
|
} else {
|
||||||
$total_rows['tax'] = array(
|
$total_rows['tax'] = array(
|
||||||
'label' => WC()->countries->tax_or_vat() . ':',
|
'label' => WC()->countries->tax_or_vat() . ':',
|
||||||
'value' => woocommerce_price( $this->get_total_tax() )
|
'value' => wc_price( $this->get_total_tax() )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -929,7 +929,7 @@ class WC_Order {
|
||||||
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$tax_string_array[] = sprintf( '%s %s', woocommerce_price( $this->get_total_tax() ), WC()->countries->tax_or_vat() );
|
$tax_string_array[] = sprintf( '%s %s', wc_price( $this->get_total_tax() ), WC()->countries->tax_or_vat() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $tax_string_array ) )
|
if ( ! empty( $tax_string_array ) )
|
||||||
|
@ -958,7 +958,7 @@ class WC_Order {
|
||||||
|
|
||||||
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
|
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
|
||||||
|
|
||||||
woocommerce_get_template( $template, array(
|
wc_get_template( $template, array(
|
||||||
'order' => $this,
|
'order' => $this,
|
||||||
'items' => $this->get_items(),
|
'items' => $this->get_items(),
|
||||||
'show_download_links' => $show_download_links,
|
'show_download_links' => $show_download_links,
|
||||||
|
@ -1015,7 +1015,7 @@ class WC_Order {
|
||||||
*/
|
*/
|
||||||
public function get_checkout_payment_url( $on_checkout = false ) {
|
public function get_checkout_payment_url( $on_checkout = false ) {
|
||||||
|
|
||||||
$pay_url = woocommerce_get_endpoint_url( 'order-pay', $this->id, get_permalink( woocommerce_get_page_id( 'checkout' ) ) );
|
$pay_url = wc_get_endpoint_url( 'order-pay', $this->id, get_permalink( wc_get_page_id( 'checkout' ) ) );
|
||||||
|
|
||||||
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' || is_ssl() )
|
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' || is_ssl() )
|
||||||
$pay_url = str_replace( 'http:', 'https:', $pay_url );
|
$pay_url = str_replace( 'http:', 'https:', $pay_url );
|
||||||
|
@ -1038,7 +1038,7 @@ class WC_Order {
|
||||||
*/
|
*/
|
||||||
public function get_checkout_order_received_url() {
|
public function get_checkout_order_received_url() {
|
||||||
|
|
||||||
$order_received_url = woocommerce_get_endpoint_url( 'order-received', $this->id, get_permalink( woocommerce_get_page_id( 'checkout' ) ) );
|
$order_received_url = wc_get_endpoint_url( 'order-received', $this->id, get_permalink( wc_get_page_id( 'checkout' ) ) );
|
||||||
|
|
||||||
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' || is_ssl() )
|
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' || is_ssl() )
|
||||||
$order_received_url = str_replace( 'http:', 'https:', $order_received_url );
|
$order_received_url = str_replace( 'http:', 'https:', $order_received_url );
|
||||||
|
@ -1065,7 +1065,7 @@ class WC_Order {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_view_order_url() {
|
public function get_view_order_url() {
|
||||||
$view_order_url = woocommerce_get_endpoint_url( 'view-order', $this->id, get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
$view_order_url = wc_get_endpoint_url( 'view-order', $this->id, get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_get_view_order_url', $view_order_url, $this );
|
return apply_filters( 'woocommerce_get_view_order_url', $view_order_url, $this );
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ class WC_Post_types {
|
||||||
'rewrite' => $product_permalink ? array( 'slug' => untrailingslashit( $product_permalink ), 'with_front' => false, 'feeds' => true ) : false,
|
'rewrite' => $product_permalink ? array( 'slug' => untrailingslashit( $product_permalink ), 'with_front' => false, 'feeds' => true ) : false,
|
||||||
'query_var' => true,
|
'query_var' => true,
|
||||||
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes' ),
|
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes' ),
|
||||||
'has_archive' => ( $shop_page_id = woocommerce_get_page_id( 'shop' ) ) && get_page( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop',
|
'has_archive' => ( $shop_page_id = wc_get_page_id( 'shop' ) ) && get_page( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop',
|
||||||
'show_in_nav_menus' => true
|
'show_in_nav_menus' => true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -282,7 +282,7 @@ class WC_Post_types {
|
||||||
|
|
||||||
$menu_name = _x('Orders', 'Admin menu name', 'woocommerce' );
|
$menu_name = _x('Orders', 'Admin menu name', 'woocommerce' );
|
||||||
|
|
||||||
if ( $order_count = woocommerce_processing_order_count() ) {
|
if ( $order_count = wc_processing_order_count() ) {
|
||||||
$menu_name .= " <span class='awaiting-mod update-plugins count-$order_count'><span class='processing-count'>" . number_format_i18n( $order_count ) . "</span></span>" ;
|
$menu_name .= " <span class='awaiting-mod update-plugins count-$order_count'><span class='processing-count'>" . number_format_i18n( $order_count ) . "</span></span>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ class WC_Product_Grouped extends WC_Product {
|
||||||
if ( $min_price ) {
|
if ( $min_price ) {
|
||||||
$display_price = $tax_display_mode == 'incl' ? $this->get_price_including_tax( 1, $min_price ) : $this->get_price_excluding_tax( 1, $min_price );
|
$display_price = $tax_display_mode == 'incl' ? $this->get_price_including_tax( 1, $min_price ) : $this->get_price_excluding_tax( 1, $min_price );
|
||||||
|
|
||||||
$price .= woocommerce_price( $display_price ) . $this->get_price_suffix();
|
$price .= wc_price( $display_price ) . $this->get_price_suffix();
|
||||||
|
|
||||||
$price = apply_filters( 'woocommerce_grouped_price_html', $price, $this );
|
$price = apply_filters( 'woocommerce_grouped_price_html', $price, $this );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -249,7 +249,7 @@ class WC_Product_Variable extends WC_Product {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$price .= woocommerce_price( $this->get_variation_price( 'min', true ) ) . $this->get_price_suffix();
|
$price .= wc_price( $this->get_variation_price( 'min', true ) ) . $this->get_price_suffix();
|
||||||
|
|
||||||
$price = apply_filters('woocommerce_variable_price_html', $price, $this);
|
$price = apply_filters('woocommerce_variable_price_html', $price, $this);
|
||||||
|
|
||||||
|
|
|
@ -297,13 +297,13 @@ class WC_Product_Variation extends WC_Product {
|
||||||
if ( $this->get_price() !== '' ) {
|
if ( $this->get_price() !== '' ) {
|
||||||
if ( $this->is_on_sale() ) {
|
if ( $this->is_on_sale() ) {
|
||||||
|
|
||||||
$price = '<del>' . woocommerce_price( $display_regular_price ) . '</del> <ins>' . woocommerce_price( $display_sale_price ) . '</ins>' . $this->get_price_suffix();
|
$price = '<del>' . wc_price( $display_regular_price ) . '</del> <ins>' . wc_price( $display_sale_price ) . '</ins>' . $this->get_price_suffix();
|
||||||
|
|
||||||
$price = apply_filters( 'woocommerce_variation_sale_price_html', $price, $this );
|
$price = apply_filters( 'woocommerce_variation_sale_price_html', $price, $this );
|
||||||
|
|
||||||
} elseif ( $this->get_price() > 0 ) {
|
} elseif ( $this->get_price() > 0 ) {
|
||||||
|
|
||||||
$price = woocommerce_price( $display_price ) . $this->get_price_suffix();
|
$price = wc_price( $display_price ) . $this->get_price_suffix();
|
||||||
|
|
||||||
$price = apply_filters( 'woocommerce_variation_price_html', $price, $this );
|
$price = apply_filters( 'woocommerce_variation_price_html', $price, $this );
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ class WC_Product_Variation extends WC_Product {
|
||||||
$identifier = '#' . $this->variation_id;
|
$identifier = '#' . $this->variation_id;
|
||||||
|
|
||||||
$attributes = $this->get_variation_attributes();
|
$attributes = $this->get_variation_attributes();
|
||||||
$extra_data = ' – ' . implode( ', ', $attributes ) . ' – ' . woocommerce_price( $this->get_price() );
|
$extra_data = ' – ' . implode( ', ', $attributes ) . ' – ' . wc_price( $this->get_price() );
|
||||||
|
|
||||||
return sprintf( __( '%s – %s%s', 'woocommerce' ), $identifier, $this->get_title(), $extra_data );
|
return sprintf( __( '%s – %s%s', 'woocommerce' ), $identifier, $this->get_title(), $extra_data );
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ class WC_Query {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// When orderby is set, WordPress shows posts. Get around that here.
|
// When orderby is set, WordPress shows posts. Get around that here.
|
||||||
if ( $q->is_home() && 'page' == get_option('show_on_front') && get_option('page_on_front') == woocommerce_get_page_id('shop') ) {
|
if ( $q->is_home() && 'page' == get_option('show_on_front') && get_option('page_on_front') == wc_get_page_id('shop') ) {
|
||||||
$_query = wp_parse_args( $q->query );
|
$_query = wp_parse_args( $q->query );
|
||||||
if ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage', 'orderby' ) ) ) {
|
if ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage', 'orderby' ) ) ) {
|
||||||
$q->is_page = true;
|
$q->is_page = true;
|
||||||
|
@ -157,7 +157,7 @@ class WC_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special check for shops with the product archive on front
|
// Special check for shops with the product archive on front
|
||||||
if ( $q->is_page() && 'page' == get_option( 'show_on_front' ) && $q->get('page_id') == woocommerce_get_page_id('shop') ) {
|
if ( $q->is_page() && 'page' == get_option( 'show_on_front' ) && $q->get('page_id') == wc_get_page_id('shop') ) {
|
||||||
|
|
||||||
// This is a front-page shop
|
// This is a front-page shop
|
||||||
$q->set( 'post_type', 'product' );
|
$q->set( 'post_type', 'product' );
|
||||||
|
@ -172,7 +172,7 @@ class WC_Query {
|
||||||
// This is hacky but works. Awaiting http://core.trac.wordpress.org/ticket/21096
|
// This is hacky but works. Awaiting http://core.trac.wordpress.org/ticket/21096
|
||||||
global $wp_post_types;
|
global $wp_post_types;
|
||||||
|
|
||||||
$shop_page = get_post( woocommerce_get_page_id('shop') );
|
$shop_page = get_post( wc_get_page_id('shop') );
|
||||||
$q->is_page = true;
|
$q->is_page = true;
|
||||||
|
|
||||||
$wp_post_types['product']->ID = $shop_page->ID;
|
$wp_post_types['product']->ID = $shop_page->ID;
|
||||||
|
@ -254,7 +254,7 @@ class WC_Query {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function wpseo_metadesc() {
|
public function wpseo_metadesc() {
|
||||||
return wpseo_get_value( 'metadesc', woocommerce_get_page_id('shop') );
|
return wpseo_get_value( 'metadesc', wc_get_page_id('shop') );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ class WC_Query {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function wpseo_metakey() {
|
public function wpseo_metakey() {
|
||||||
return wpseo_get_value( 'metakey', woocommerce_get_page_id('shop') );
|
return wpseo_get_value( 'metakey', wc_get_page_id('shop') );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ class WC_Query {
|
||||||
public function get_catalog_ordering_args( $orderby = '', $order = '' ) {
|
public function get_catalog_ordering_args( $orderby = '', $order = '' ) {
|
||||||
// Get ordering from query string unless defined
|
// Get ordering from query string unless defined
|
||||||
if ( ! $orderby ) {
|
if ( ! $orderby ) {
|
||||||
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
||||||
|
|
||||||
// Get order + orderby args from string
|
// Get order + orderby args from string
|
||||||
$orderby_value = explode( '-', $orderby_value );
|
$orderby_value = explode( '-', $orderby_value );
|
||||||
|
@ -627,7 +627,7 @@ class WC_Query {
|
||||||
if ( $attribute_taxonomies ) {
|
if ( $attribute_taxonomies ) {
|
||||||
foreach ( $attribute_taxonomies as $tax ) {
|
foreach ( $attribute_taxonomies as $tax ) {
|
||||||
|
|
||||||
$attribute = woocommerce_sanitize_taxonomy_name( $tax->attribute_name );
|
$attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
|
||||||
$taxonomy = wc_attribute_taxonomy_name( $attribute );
|
$taxonomy = wc_attribute_taxonomy_name( $attribute );
|
||||||
$name = 'filter_' . $attribute;
|
$name = 'filter_' . $attribute;
|
||||||
$query_type_name = 'query_type_' . $attribute;
|
$query_type_name = 'query_type_' . $attribute;
|
||||||
|
|
|
@ -182,7 +182,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
foreach ( $product_categories as $category ) {
|
foreach ( $product_categories as $category ) {
|
||||||
|
|
||||||
woocommerce_get_template( 'content-product_cat.php', array(
|
wc_get_template( 'content-product_cat.php', array(
|
||||||
'category' => $category
|
'category' => $category
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<div class="single-product">
|
<div class="single-product">
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'single-product' ); ?>
|
<?php wc_get_template_part( 'content', 'single-product' ); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -929,7 +929,7 @@ class WC_Shortcodes {
|
||||||
|
|
||||||
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
|
|
@ -225,11 +225,11 @@ class WC_Tax {
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
// Handle postcodes
|
// Handle postcodes
|
||||||
$valid_postcodes = array( '*', strtoupper( woocommerce_clean( $postcode ) ) );
|
$valid_postcodes = array( '*', strtoupper( wc_clean( $postcode ) ) );
|
||||||
|
|
||||||
// Work out possible valid wildcard postcodes
|
// Work out possible valid wildcard postcodes
|
||||||
$postcode_length = strlen( $postcode );
|
$postcode_length = strlen( $postcode );
|
||||||
$wildcard_postcode = strtoupper( woocommerce_clean( $postcode ) );
|
$wildcard_postcode = strtoupper( wc_clean( $postcode ) );
|
||||||
|
|
||||||
for ( $i = 0; $i < $postcode_length; $i ++ ) {
|
for ( $i = 0; $i < $postcode_length; $i ++ ) {
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class WC_Template_Loader {
|
||||||
$find[] = $file;
|
$find[] = $file;
|
||||||
$find[] = WC_TEMPLATE_PATH . $file;
|
$find[] = WC_TEMPLATE_PATH . $file;
|
||||||
|
|
||||||
} elseif ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id( 'shop' ) ) ) {
|
} elseif ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) {
|
||||||
|
|
||||||
$file = 'archive-product.php';
|
$file = 'archive-product.php';
|
||||||
$find[] = $file;
|
$find[] = $file;
|
||||||
|
|
|
@ -56,7 +56,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
|
||||||
$this->recipient = $this->object->billing_email;
|
$this->recipient = $this->object->billing_email;
|
||||||
|
|
||||||
$this->find[] = '{order_date}';
|
$this->find[] = '{order_date}';
|
||||||
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
|
$this->replace[] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
|
||||||
|
|
||||||
$this->find[] = '{order_number}';
|
$this->find[] = '{order_number}';
|
||||||
$this->replace[] = $this->object->get_order_number();
|
$this->replace[] = $this->object->get_order_number();
|
||||||
|
@ -102,7 +102,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
@ -117,7 +117,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
|
|
@ -62,7 +62,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
|
||||||
$this->recipient = $this->object->billing_email;
|
$this->recipient = $this->object->billing_email;
|
||||||
|
|
||||||
$this->find[] = '{order_date}';
|
$this->find[] = '{order_date}';
|
||||||
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
|
$this->replace[] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
|
||||||
|
|
||||||
$this->find[] = '{order_number}';
|
$this->find[] = '{order_number}';
|
||||||
$this->replace[] = $this->object->get_order_number();
|
$this->replace[] = $this->object->get_order_number();
|
||||||
|
@ -108,7 +108,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
@ -123,7 +123,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
|
|
@ -75,7 +75,7 @@ class WC_Email_Customer_New_Account extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'email_heading' => $this->get_heading(),
|
'email_heading' => $this->get_heading(),
|
||||||
'user_login' => $this->user_login,
|
'user_login' => $this->user_login,
|
||||||
'user_pass' => $this->user_pass,
|
'user_pass' => $this->user_pass,
|
||||||
|
@ -93,7 +93,7 @@ class WC_Email_Customer_New_Account extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'email_heading' => $this->get_heading(),
|
'email_heading' => $this->get_heading(),
|
||||||
'user_login' => $this->user_login,
|
'user_login' => $this->user_login,
|
||||||
'user_pass' => $this->user_pass,
|
'user_pass' => $this->user_pass,
|
||||||
|
|
|
@ -88,7 +88,7 @@ class WC_Email_Customer_Note extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading(),
|
'email_heading' => $this->get_heading(),
|
||||||
'customer_note' => $this->customer_note
|
'customer_note' => $this->customer_note
|
||||||
|
@ -104,7 +104,7 @@ class WC_Email_Customer_Note extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading(),
|
'email_heading' => $this->get_heading(),
|
||||||
'customer_note' => $this->customer_note
|
'customer_note' => $this->customer_note
|
||||||
|
|
|
@ -53,7 +53,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
|
||||||
$this->recipient = $this->object->billing_email;
|
$this->recipient = $this->object->billing_email;
|
||||||
|
|
||||||
$this->find[] = '{order_date}';
|
$this->find[] = '{order_date}';
|
||||||
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
|
$this->replace[] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
|
||||||
|
|
||||||
$this->find[] = '{order_number}';
|
$this->find[] = '{order_number}';
|
||||||
$this->replace[] = $this->object->get_order_number();
|
$this->replace[] = $this->object->get_order_number();
|
||||||
|
@ -73,7 +73,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
@ -88,7 +88,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
|
|
@ -82,7 +82,7 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'email_heading' => $this->get_heading(),
|
'email_heading' => $this->get_heading(),
|
||||||
'user_login' => $this->user_login,
|
'user_login' => $this->user_login,
|
||||||
'reset_key' => $this->reset_key,
|
'reset_key' => $this->reset_key,
|
||||||
|
@ -99,7 +99,7 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'email_heading' => $this->get_heading(),
|
'email_heading' => $this->get_heading(),
|
||||||
'user_login' => $this->user_login,
|
'user_login' => $this->user_login,
|
||||||
'reset_key' => $this->reset_key,
|
'reset_key' => $this->reset_key,
|
||||||
|
|
|
@ -62,7 +62,7 @@ class WC_Email_New_Order extends WC_Email {
|
||||||
$this->object = new WC_Order( $order_id );
|
$this->object = new WC_Order( $order_id );
|
||||||
|
|
||||||
$this->find[] = '{order_date}';
|
$this->find[] = '{order_date}';
|
||||||
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
|
$this->replace[] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
|
||||||
|
|
||||||
$this->find[] = '{order_number}';
|
$this->find[] = '{order_number}';
|
||||||
$this->replace[] = $this->object->get_order_number();
|
$this->replace[] = $this->object->get_order_number();
|
||||||
|
@ -82,7 +82,7 @@ class WC_Email_New_Order extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_html() {
|
function get_content_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_html, array(
|
wc_get_template( $this->template_html, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
@ -97,7 +97,7 @@ class WC_Email_New_Order extends WC_Email {
|
||||||
*/
|
*/
|
||||||
function get_content_plain() {
|
function get_content_plain() {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( $this->template_plain, array(
|
wc_get_template( $this->template_plain, array(
|
||||||
'order' => $this->object,
|
'order' => $this->object,
|
||||||
'email_heading' => $this->get_heading()
|
'email_heading' => $this->get_heading()
|
||||||
) );
|
) );
|
||||||
|
|
|
@ -176,12 +176,12 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
|
|
||||||
if ( isset( $_POST['bacs_account_name'] ) ) {
|
if ( isset( $_POST['bacs_account_name'] ) ) {
|
||||||
|
|
||||||
$account_names = array_map( 'woocommerce_clean', $_POST['bacs_account_name'] );
|
$account_names = array_map( 'wc_clean', $_POST['bacs_account_name'] );
|
||||||
$account_numbers = array_map( 'woocommerce_clean', $_POST['bacs_account_number'] );
|
$account_numbers = array_map( 'wc_clean', $_POST['bacs_account_number'] );
|
||||||
$bank_names = array_map( 'woocommerce_clean', $_POST['bacs_bank_name'] );
|
$bank_names = array_map( 'wc_clean', $_POST['bacs_bank_name'] );
|
||||||
$sort_codes = array_map( 'woocommerce_clean', $_POST['bacs_sort_code'] );
|
$sort_codes = array_map( 'wc_clean', $_POST['bacs_sort_code'] );
|
||||||
$ibans = array_map( 'woocommerce_clean', $_POST['bacs_iban'] );
|
$ibans = array_map( 'wc_clean', $_POST['bacs_iban'] );
|
||||||
$bics = array_map( 'woocommerce_clean', $_POST['bacs_bic'] );
|
$bics = array_map( 'wc_clean', $_POST['bacs_bic'] );
|
||||||
|
|
||||||
foreach ( $account_names as $i => $name ) {
|
foreach ( $account_names as $i => $name ) {
|
||||||
if ( ! isset( $account_names[ $i ] ) )
|
if ( ! isset( $account_names[ $i ] ) )
|
||||||
|
|
|
@ -110,7 +110,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
|
||||||
$chosen_shipping_methods = array_unique( WC()->session->get( 'chosen_shipping_methods' ) );
|
$chosen_shipping_methods = array_unique( WC()->session->get( 'chosen_shipping_methods' ) );
|
||||||
$check_method = false;
|
$check_method = false;
|
||||||
|
|
||||||
if ( is_page( woocommerce_get_page_id( 'checkout' ) ) && ! empty( $wp->query_vars['order-pay'] ) ) {
|
if ( is_page( wc_get_page_id( 'checkout' ) ) && ! empty( $wp->query_vars['order-pay'] ) ) {
|
||||||
|
|
||||||
$order_id = absint( $wp->query_vars['order-pay'] );
|
$order_id = absint( $wp->query_vars['order-pay'] );
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
|
|
|
@ -858,7 +858,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
||||||
|
|
||||||
if ( ! isset( $order->id ) ) {
|
if ( ! isset( $order->id ) ) {
|
||||||
// We have an invalid $order_id, probably because invoice_prefix has changed
|
// We have an invalid $order_id, probably because invoice_prefix has changed
|
||||||
$order_id = woocommerce_get_order_id_by_order_key( $order_key );
|
$order_id = wc_get_order_id_by_order_key( $order_key );
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -626,7 +626,7 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
||||||
$flat_rate_fee = array();
|
$flat_rate_fee = array();
|
||||||
$flat_rates = array();
|
$flat_rates = array();
|
||||||
|
|
||||||
if ( isset( $_POST[ $this->id . '_class'] ) ) $flat_rate_class = array_map( 'woocommerce_clean', $_POST[ $this->id . '_class'] );
|
if ( isset( $_POST[ $this->id . '_class'] ) ) $flat_rate_class = array_map( 'wc_clean', $_POST[ $this->id . '_class'] );
|
||||||
if ( isset( $_POST[ $this->id . '_cost'] ) ) $flat_rate_cost = array_map( 'stripslashes', $_POST[ $this->id . '_cost'] );
|
if ( isset( $_POST[ $this->id . '_cost'] ) ) $flat_rate_cost = array_map( 'stripslashes', $_POST[ $this->id . '_cost'] );
|
||||||
if ( isset( $_POST[ $this->id . '_fee'] ) ) $flat_rate_fee = array_map( 'stripslashes', $_POST[ $this->id . '_fee'] );
|
if ( isset( $_POST[ $this->id . '_fee'] ) ) $flat_rate_fee = array_map( 'stripslashes', $_POST[ $this->id . '_fee'] );
|
||||||
|
|
||||||
|
@ -639,12 +639,12 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
||||||
for ( $i = 0; $i <= $key; $i++ ) {
|
for ( $i = 0; $i <= $key; $i++ ) {
|
||||||
if ( ! empty( $flat_rate_class[ $i ] ) && isset( $flat_rate_cost[ $i ] ) && isset( $flat_rate_fee[ $i ] ) ) {
|
if ( ! empty( $flat_rate_class[ $i ] ) && isset( $flat_rate_cost[ $i ] ) && isset( $flat_rate_fee[ $i ] ) ) {
|
||||||
|
|
||||||
$flat_rate_cost[ $i ] = woocommerce_format_decimal( $flat_rate_cost[$i] );
|
$flat_rate_cost[ $i ] = wc_format_decimal( $flat_rate_cost[$i] );
|
||||||
|
|
||||||
if ( ! strstr( $flat_rate_fee[$i], '%' ) )
|
if ( ! strstr( $flat_rate_fee[$i], '%' ) )
|
||||||
$flat_rate_fee[ $i ] = woocommerce_format_decimal( $flat_rate_fee[$i] );
|
$flat_rate_fee[ $i ] = wc_format_decimal( $flat_rate_fee[$i] );
|
||||||
else
|
else
|
||||||
$flat_rate_fee[ $i ] = woocommerce_clean( $flat_rate_fee[$i] );
|
$flat_rate_fee[ $i ] = wc_clean( $flat_rate_fee[$i] );
|
||||||
|
|
||||||
// Add to flat rates array
|
// Add to flat rates array
|
||||||
$flat_rates[ sanitize_title($flat_rate_class[$i]) ] = array(
|
$flat_rates[ sanitize_title($flat_rate_class[$i]) ] = array(
|
||||||
|
@ -667,12 +667,12 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function save_default_costs( $fields ) {
|
function save_default_costs( $fields ) {
|
||||||
$default_cost = ( $_POST['default_cost'] === '' ) ? '' : woocommerce_format_decimal( $_POST['default_cost'] );
|
$default_cost = ( $_POST['default_cost'] === '' ) ? '' : wc_format_decimal( $_POST['default_cost'] );
|
||||||
|
|
||||||
if ( ! strstr( $_POST['default_fee'], '%' ) )
|
if ( ! strstr( $_POST['default_fee'], '%' ) )
|
||||||
$default_fee = ( $_POST['default_fee'] === '' ) ? '' : woocommerce_format_decimal( $_POST['default_fee'] );
|
$default_fee = ( $_POST['default_fee'] === '' ) ? '' : wc_format_decimal( $_POST['default_fee'] );
|
||||||
else
|
else
|
||||||
$default_fee = woocommerce_clean( $_POST['default_fee'] );
|
$default_fee = wc_clean( $_POST['default_fee'] );
|
||||||
|
|
||||||
$fields['cost'] = $default_cost;
|
$fields['cost'] = $default_cost;
|
||||||
$fields['fee'] = $default_fee;
|
$fields['fee'] = $default_fee;
|
||||||
|
|
|
@ -34,7 +34,7 @@ class WC_Shortcode_Cart {
|
||||||
// Remove Coupon Codes
|
// Remove Coupon Codes
|
||||||
} elseif ( isset( $_GET['remove_coupon'] ) ) {
|
} elseif ( isset( $_GET['remove_coupon'] ) ) {
|
||||||
|
|
||||||
WC()->cart->remove_coupon( woocommerce_clean( $_GET['remove_coupon'] ) );
|
WC()->cart->remove_coupon( wc_clean( $_GET['remove_coupon'] ) );
|
||||||
|
|
||||||
// Update Shipping
|
// Update Shipping
|
||||||
} elseif ( ! empty( $_POST['calc_shipping'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-cart' ) ) {
|
} elseif ( ! empty( $_POST['calc_shipping'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-cart' ) ) {
|
||||||
|
@ -42,10 +42,10 @@ class WC_Shortcode_Cart {
|
||||||
try {
|
try {
|
||||||
WC()->shipping->reset_shipping();
|
WC()->shipping->reset_shipping();
|
||||||
|
|
||||||
$country = woocommerce_clean( $_POST['calc_shipping_country'] );
|
$country = wc_clean( $_POST['calc_shipping_country'] );
|
||||||
$state = woocommerce_clean( $_POST['calc_shipping_state'] );
|
$state = wc_clean( $_POST['calc_shipping_state'] );
|
||||||
$postcode = apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true ) ? woocommerce_clean( $_POST['calc_shipping_postcode'] ) : '';
|
$postcode = apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true ) ? wc_clean( $_POST['calc_shipping_postcode'] ) : '';
|
||||||
$city = apply_filters( 'woocommerce_shipping_calculator_enable_city', false ) ? woocommerce_clean( $_POST['calc_shipping_city'] ) : '';
|
$city = apply_filters( 'woocommerce_shipping_calculator_enable_city', false ) ? wc_clean( $_POST['calc_shipping_city'] ) : '';
|
||||||
|
|
||||||
if ( $postcode && ! WC_Validation::is_postcode( $postcode, $country ) ) {
|
if ( $postcode && ! WC_Validation::is_postcode( $postcode, $country ) ) {
|
||||||
throw new Exception( __( 'Please enter a valid postcode/ZIP.', 'woocommerce' ) );
|
throw new Exception( __( 'Please enter a valid postcode/ZIP.', 'woocommerce' ) );
|
||||||
|
@ -81,9 +81,9 @@ class WC_Shortcode_Cart {
|
||||||
WC()->cart->calculate_totals();
|
WC()->cart->calculate_totals();
|
||||||
|
|
||||||
if ( sizeof( WC()->cart->get_cart() ) == 0 )
|
if ( sizeof( WC()->cart->get_cart() ) == 0 )
|
||||||
woocommerce_get_template( 'cart/cart-empty.php' );
|
wc_get_template( 'cart/cart-empty.php' );
|
||||||
else
|
else
|
||||||
woocommerce_get_template( 'cart/cart.php' );
|
wc_get_template( 'cart/cart.php' );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,6 +31,6 @@ class WC_Shortcode_Change_Password {
|
||||||
|
|
||||||
if ( ! is_user_logged_in() ) return;
|
if ( ! is_user_logged_in() ) return;
|
||||||
|
|
||||||
woocommerce_get_template( 'myaccount/form-change-password.php' );
|
wc_get_template( 'myaccount/form-change-password.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -83,7 +83,7 @@ class WC_Shortcode_Checkout {
|
||||||
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
|
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
|
||||||
|
|
||||||
if ( ! current_user_can( 'pay_for_order', $order_id ) ) {
|
if ( ! current_user_can( 'pay_for_order', $order_id ) ) {
|
||||||
echo '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( woocommerce_get_page_id( 'myaccount' ) ) . '" class="wc-forward">' . __( 'My Account', 'woocommerce' ) . '</a>' . '</div>';
|
echo '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '" class="wc-forward">' . __( 'My Account', 'woocommerce' ) . '</a>' . '</div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class WC_Shortcode_Checkout {
|
||||||
if ( $order->billing_postcode )
|
if ( $order->billing_postcode )
|
||||||
WC()->customer->set_postcode( $order->billing_postcode );
|
WC()->customer->set_postcode( $order->billing_postcode );
|
||||||
|
|
||||||
woocommerce_get_template( 'checkout/form-pay.php', array( 'order' => $order ) );
|
wc_get_template( 'checkout/form-pay.php', array( 'order' => $order ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class WC_Shortcode_Checkout {
|
||||||
} elseif ( $order_id ) {
|
} elseif ( $order_id ) {
|
||||||
|
|
||||||
// Pay for order after checkout step
|
// Pay for order after checkout step
|
||||||
$order_key = isset( $_GET['key'] ) ? woocommerce_clean( $_GET['key'] ) : '';
|
$order_key = isset( $_GET['key'] ) ? wc_clean( $_GET['key'] ) : '';
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
|
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class WC_Shortcode_Checkout {
|
||||||
|
|
||||||
// Get the order
|
// Get the order
|
||||||
$order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $order_id ) );
|
$order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $order_id ) );
|
||||||
$order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : woocommerce_clean( $_GET['key'] ) );
|
$order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) );
|
||||||
|
|
||||||
if ( $order_id > 0 ) {
|
if ( $order_id > 0 ) {
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
|
@ -194,7 +194,7 @@ class WC_Shortcode_Checkout {
|
||||||
// Empty awaiting payment session
|
// Empty awaiting payment session
|
||||||
unset( WC()->session->order_awaiting_payment );
|
unset( WC()->session->order_awaiting_payment );
|
||||||
|
|
||||||
woocommerce_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
|
wc_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,7 +220,7 @@ class WC_Shortcode_Checkout {
|
||||||
|
|
||||||
if ( empty( $_POST ) && wc_notice_count( 'wc_errors' ) > 0 ) {
|
if ( empty( $_POST ) && wc_notice_count( 'wc_errors' ) > 0 ) {
|
||||||
|
|
||||||
woocommerce_get_template( 'checkout/cart-errors.php', array( 'checkout' => $checkout ) );
|
wc_get_template( 'checkout/cart-errors.php', array( 'checkout' => $checkout ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class WC_Shortcode_Checkout {
|
||||||
if ( wc_notice_count( 'wc_errors' ) == 0 && $non_js_checkout )
|
if ( wc_notice_count( 'wc_errors' ) == 0 && $non_js_checkout )
|
||||||
wc_add_notice( __( 'The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce' ) );
|
wc_add_notice( __( 'The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce' ) );
|
||||||
|
|
||||||
woocommerce_get_template( 'checkout/form-checkout.php', array( 'checkout' => $checkout ) );
|
wc_get_template( 'checkout/form-checkout.php', array( 'checkout' => $checkout ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class WC_Shortcode_My_Account {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
woocommerce_get_template( 'myaccount/form-login.php' );
|
wc_get_template( 'myaccount/form-login.php' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class WC_Shortcode_My_Account {
|
||||||
'order_count' => 15
|
'order_count' => 15
|
||||||
), $atts ) );
|
), $atts ) );
|
||||||
|
|
||||||
woocommerce_get_template( 'myaccount/my-account.php', array(
|
wc_get_template( 'myaccount/my-account.php', array(
|
||||||
'current_user' => get_user_by( 'id', get_current_user_id() ),
|
'current_user' => get_user_by( 'id', get_current_user_id() ),
|
||||||
'order_count' => 'all' == $order_count ? -1 : $order_count
|
'order_count' => 'all' == $order_count ? -1 : $order_count
|
||||||
) );
|
) );
|
||||||
|
@ -103,7 +103,7 @@ class WC_Shortcode_My_Account {
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
|
|
||||||
if ( !current_user_can( 'view_order', $order_id ) ) {
|
if ( !current_user_can( 'view_order', $order_id ) ) {
|
||||||
echo '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( woocommerce_get_page_id( 'myaccount' ) ).'">'. __( 'My Account →', 'woocommerce' ) .'</a>' . '</div>';
|
echo '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ).'">'. __( 'My Account →', 'woocommerce' ) .'</a>' . '</div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class WC_Shortcode_My_Account {
|
||||||
* Edit account details page
|
* Edit account details page
|
||||||
*/
|
*/
|
||||||
private static function edit_account() {
|
private static function edit_account() {
|
||||||
woocommerce_get_template( 'myaccount/form-edit-account.php', array( 'user' => get_user_by( 'id', get_current_user_id() ) ) );
|
wc_get_template( 'myaccount/form-edit-account.php', array( 'user' => get_user_by( 'id', get_current_user_id() ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +187,7 @@ class WC_Shortcode_My_Account {
|
||||||
$address[ $key ]['value'] = apply_filters( 'woocommerce_my_account_edit_address_field_value', $value, $key, $load_address );
|
$address[ $key ]['value'] = apply_filters( 'woocommerce_my_account_edit_address_field_value', $value, $key, $load_address );
|
||||||
}
|
}
|
||||||
|
|
||||||
woocommerce_get_template( 'myaccount/form-edit-address.php', array(
|
wc_get_template( 'myaccount/form-edit-address.php', array(
|
||||||
'load_address' => $load_address,
|
'load_address' => $load_address,
|
||||||
'address' => apply_filters( 'woocommerce_address_to_edit', $address )
|
'address' => apply_filters( 'woocommerce_address_to_edit', $address )
|
||||||
) );
|
) );
|
||||||
|
@ -216,7 +216,7 @@ class WC_Shortcode_My_Account {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
woocommerce_get_template( 'myaccount/form-lost-password.php', $args );
|
wc_get_template( 'myaccount/form-lost-password.php', $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -357,7 +357,7 @@ class WC_Shortcode_My_Account {
|
||||||
|
|
||||||
if ( ! is_user_logged_in() ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
|
|
||||||
wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -369,7 +369,7 @@ class WC_Shortcode_My_Account {
|
||||||
wc_print_messages();
|
wc_print_messages();
|
||||||
|
|
||||||
// Add payment method form
|
// Add payment method form
|
||||||
woocommerce_get_template( 'myaccount/form-add-payment-method.php' );
|
wc_get_template( 'myaccount/form-add-payment-method.php' );
|
||||||
|
|
||||||
wc_print_messages();
|
wc_print_messages();
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class WC_Shortcode_Order_Tracking {
|
||||||
|
|
||||||
if ( strtolower( $order->billing_email ) == strtolower( $order_email ) ) {
|
if ( strtolower( $order->billing_email ) == strtolower( $order_email ) ) {
|
||||||
do_action( 'woocommerce_track_order', $order->id );
|
do_action( 'woocommerce_track_order', $order->id );
|
||||||
woocommerce_get_template( 'order/tracking.php', array(
|
wc_get_template( 'order/tracking.php', array(
|
||||||
'order' => $order
|
'order' => $order
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -77,6 +77,6 @@ class WC_Shortcode_Order_Tracking {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
woocommerce_get_template( 'order/form-tracking.php' );
|
wc_get_template( 'order/form-tracking.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,18 +41,18 @@ class WC_Shortcode_View_Order {
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
|
|
||||||
if ( $order_id == 0 ) {
|
if ( $order_id == 0 ) {
|
||||||
woocommerce_get_template( 'myaccount/my-orders.php', array( 'order_count' => 'all' == $order_count ? -1 : $order_count ) );
|
wc_get_template( 'myaccount/my-orders.php', array( 'order_count' => 'all' == $order_count ? -1 : $order_count ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !current_user_can( 'view_order', $order_id ) ) {
|
if ( !current_user_can( 'view_order', $order_id ) ) {
|
||||||
echo '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( woocommerce_get_page_id( 'myaccount' ) ) . '" class="wc-forward">' . __( 'My Account', 'woocommerce' ) . '</a>' . '</div>';
|
echo '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '" class="wc-forward">' . __( 'My Account', 'woocommerce' ) . '</a>' . '</div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = get_term_by('slug', $order->status, 'shop_order_status');
|
$status = get_term_by('slug', $order->status, 'shop_order_status');
|
||||||
|
|
||||||
woocommerce_get_template( 'myaccount/view-order.php', array(
|
wc_get_template( 'myaccount/view-order.php', array(
|
||||||
'order_id' => $order_id,
|
'order_id' => $order_id,
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'status' => $status
|
'status' => $status
|
||||||
|
|
|
@ -39,7 +39,7 @@ $wpdb->query( "ALTER TABLE {$wpdb->prefix}woocommerce_downloadable_product_permi
|
||||||
|
|
||||||
// Setup default permalinks if shop page is defined
|
// Setup default permalinks if shop page is defined
|
||||||
$permalinks = get_option( 'woocommerce_permalinks' );
|
$permalinks = get_option( 'woocommerce_permalinks' );
|
||||||
$shop_page_id = woocommerce_get_page_id( 'shop' );
|
$shop_page_id = wc_get_page_id( 'shop' );
|
||||||
|
|
||||||
if ( empty( $permalinks ) && $shop_page_id > 0 ) {
|
if ( empty( $permalinks ) && $shop_page_id > 0 ) {
|
||||||
|
|
||||||
|
@ -201,21 +201,21 @@ foreach ( $order_item_rows as $order_item_row ) {
|
||||||
$order_item['line_subtotal_tax'] = isset( $order_item['line_subtotal_tax'] ) ? $order_item['line_subtotal_tax'] : 0;
|
$order_item['line_subtotal_tax'] = isset( $order_item['line_subtotal_tax'] ) ? $order_item['line_subtotal_tax'] : 0;
|
||||||
$order_item['line_subtotal'] = isset( $order_item['line_subtotal'] ) ? $order_item['line_subtotal'] : 0;
|
$order_item['line_subtotal'] = isset( $order_item['line_subtotal'] ) ? $order_item['line_subtotal'] : 0;
|
||||||
|
|
||||||
$item_id = woocommerce_add_order_item( $order_item_row->post_id, array(
|
$item_id = wc_add_order_item( $order_item_row->post_id, array(
|
||||||
'order_item_name' => $order_item['name'],
|
'order_item_name' => $order_item['name'],
|
||||||
'order_item_type' => 'line_item'
|
'order_item_type' => 'line_item'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, '_qty', absint( $order_item['qty'] ) );
|
wc_add_order_item_meta( $item_id, '_qty', absint( $order_item['qty'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_tax_class', $order_item['tax_class'] );
|
wc_add_order_item_meta( $item_id, '_tax_class', $order_item['tax_class'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_product_id', $order_item['id'] );
|
wc_add_order_item_meta( $item_id, '_product_id', $order_item['id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_variation_id', $order_item['variation_id'] );
|
wc_add_order_item_meta( $item_id, '_variation_id', $order_item['variation_id'] );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_subtotal', woocommerce_format_decimal( $order_item['line_subtotal'] ) );
|
wc_add_order_item_meta( $item_id, '_line_subtotal', wc_format_decimal( $order_item['line_subtotal'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_subtotal_tax', woocommerce_format_decimal( $order_item['line_subtotal_tax'] ) );
|
wc_add_order_item_meta( $item_id, '_line_subtotal_tax', wc_format_decimal( $order_item['line_subtotal_tax'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_total', woocommerce_format_decimal( $order_item['line_total'] ) );
|
wc_add_order_item_meta( $item_id, '_line_total', wc_format_decimal( $order_item['line_total'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, '_line_tax', woocommerce_format_decimal( $order_item['line_tax'] ) );
|
wc_add_order_item_meta( $item_id, '_line_tax', wc_format_decimal( $order_item['line_tax'] ) );
|
||||||
|
|
||||||
$meta_rows = array();
|
$meta_rows = array();
|
||||||
|
|
||||||
|
@ -269,16 +269,16 @@ foreach ( $order_tax_rows as $order_tax_row ) {
|
||||||
if ( ! isset( $order_tax['label'] ) || ! isset( $order_tax['cart_tax'] ) || ! isset( $order_tax['shipping_tax'] ) )
|
if ( ! isset( $order_tax['label'] ) || ! isset( $order_tax['cart_tax'] ) || ! isset( $order_tax['shipping_tax'] ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$item_id = woocommerce_add_order_item( $order_tax_row->post_id, array(
|
$item_id = wc_add_order_item( $order_tax_row->post_id, array(
|
||||||
'order_item_name' => $order_tax['label'],
|
'order_item_name' => $order_tax['label'],
|
||||||
'order_item_type' => 'tax'
|
'order_item_type' => 'tax'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add line item meta
|
// Add line item meta
|
||||||
if ( $item_id ) {
|
if ( $item_id ) {
|
||||||
woocommerce_add_order_item_meta( $item_id, 'compound', absint( isset( $order_tax['compound'] ) ? $order_tax['compound'] : 0 ) );
|
wc_add_order_item_meta( $item_id, 'compound', absint( isset( $order_tax['compound'] ) ? $order_tax['compound'] : 0 ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'tax_amount', woocommerce_clean( $order_tax['cart_tax'] ) );
|
wc_add_order_item_meta( $item_id, 'tax_amount', wc_clean( $order_tax['cart_tax'] ) );
|
||||||
woocommerce_add_order_item_meta( $item_id, 'shipping_tax_amount', woocommerce_clean( $order_tax['shipping_tax'] ) );
|
wc_add_order_item_meta( $item_id, 'shipping_tax_amount', wc_clean( $order_tax['shipping_tax'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete from DB (rename)
|
// Delete from DB (rename)
|
||||||
|
|
|
@ -42,7 +42,7 @@ if ( $existing_file_paths ) {
|
||||||
$needs_update = true;
|
$needs_update = true;
|
||||||
$new_value[ $key ] = array(
|
$new_value[ $key ] = array(
|
||||||
'file' => $file,
|
'file' => $file,
|
||||||
'name' => woocommerce_get_filename_from_url( $file )
|
'name' => wc_get_filename_from_url( $file )
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$new_value[ $key ] = $file;
|
$new_value[ $key ] = $file;
|
||||||
|
|
|
@ -38,7 +38,7 @@ function wc_get_attribute_taxonomies() {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function wc_attribute_taxonomy_name( $name ) {
|
function wc_attribute_taxonomy_name( $name ) {
|
||||||
return 'pa_' . woocommerce_sanitize_taxonomy_name( $name );
|
return 'pa_' . wc_sanitize_taxonomy_name( $name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ function wc_attribute_label( $name ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
if ( taxonomy_is_product_attribute( $name ) ) {
|
if ( taxonomy_is_product_attribute( $name ) ) {
|
||||||
$name = woocommerce_sanitize_taxonomy_name( str_replace( 'pa_', '', $name ) );
|
$name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $name ) );
|
||||||
|
|
||||||
$label = $wpdb->get_var( $wpdb->prepare( "SELECT attribute_label FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name = %s;", $name ) );
|
$label = $wpdb->get_var( $wpdb->prepare( "SELECT attribute_label FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name = %s;", $name ) );
|
||||||
|
|
||||||
|
|
|
@ -19,21 +19,21 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
* @param int $product_id
|
* @param int $product_id
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_protected_product_add_to_cart( $passed, $product_id ) {
|
function wc_protected_product_add_to_cart( $passed, $product_id ) {
|
||||||
if ( post_password_required( $product_id ) ) {
|
if ( post_password_required( $product_id ) ) {
|
||||||
$passed = false;
|
$passed = false;
|
||||||
wc_add_notice( __( 'This product is protected and cannot be purchased.', 'woocommerce' ), 'error' );
|
wc_add_notice( __( 'This product is protected and cannot be purchased.', 'woocommerce' ), 'error' );
|
||||||
}
|
}
|
||||||
return $passed;
|
return $passed;
|
||||||
}
|
}
|
||||||
add_filter( 'woocommerce_add_to_cart_validation', 'woocommerce_protected_product_add_to_cart', 10, 2 );
|
add_filter( 'woocommerce_add_to_cart_validation', 'wc_protected_product_add_to_cart', 10, 2 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WooCommerce clear cart
|
|
||||||
*
|
|
||||||
* Clears the cart session when called
|
* Clears the cart session when called
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_empty_cart() {
|
function wc_empty_cart() {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
if ( ! isset( WC()->cart ) || WC()->cart == '' )
|
if ( ! isset( WC()->cart ) || WC()->cart == '' )
|
||||||
|
@ -41,15 +41,17 @@ function woocommerce_empty_cart() {
|
||||||
|
|
||||||
WC()->cart->empty_cart( false );
|
WC()->cart->empty_cart( false );
|
||||||
}
|
}
|
||||||
add_action( 'wp_logout', 'woocommerce_empty_cart' );
|
add_action( 'wp_logout', 'wc_empty_cart' );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the cart upon login
|
* Load the cart upon login
|
||||||
|
*
|
||||||
* @param mixed $user_login
|
* @param mixed $user_login
|
||||||
* @param mixed $user
|
* @param mixed $user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_load_persistent_cart( $user_login, $user = 0 ) {
|
function wc_load_persistent_cart( $user_login, $user = 0 ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
if ( ! $user )
|
if ( ! $user )
|
||||||
|
@ -61,16 +63,17 @@ function woocommerce_load_persistent_cart( $user_login, $user = 0 ) {
|
||||||
if ( empty( WC()->session->cart ) || ! is_array( WC()->session->cart ) || sizeof( WC()->session->cart ) == 0 )
|
if ( empty( WC()->session->cart ) || ! is_array( WC()->session->cart ) || sizeof( WC()->session->cart ) == 0 )
|
||||||
WC()->session->cart = $saved_cart['cart'];
|
WC()->session->cart = $saved_cart['cart'];
|
||||||
}
|
}
|
||||||
add_action( 'wp_login', 'woocommerce_load_persistent_cart', 1, 2 );
|
add_action( 'wp_login', 'wc_load_persistent_cart', 1, 2 );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add to cart messages.
|
* Add to cart messages.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
* @param int $product_id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_add_to_cart_message( $product_id ) {
|
function wc_add_to_cart_message( $product_id ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
if ( is_array( $product_id ) ) {
|
if ( is_array( $product_id ) ) {
|
||||||
|
@ -96,11 +99,11 @@ function woocommerce_add_to_cart_message( $product_id ) {
|
||||||
|
|
||||||
else :
|
else :
|
||||||
|
|
||||||
$message = sprintf('<a href="%s" class="button">%s</a> %s', get_permalink( woocommerce_get_page_id( 'cart' ) ), __( 'View Cart →', 'woocommerce' ), $added_text );
|
$message = sprintf('<a href="%s" class="button">%s</a> %s', get_permalink( wc_get_page_id( 'cart' ) ), __( 'View Cart →', 'woocommerce' ), $added_text );
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
wc_add_notice( apply_filters( 'woocommerce_add_to_cart_message', $message ) );
|
wc_add_notice( apply_filters( 'wc_add_to_cart_message', $message ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +112,7 @@ function woocommerce_add_to_cart_message( $product_id ) {
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_clear_cart_after_payment() {
|
function wc_clear_cart_after_payment() {
|
||||||
global $woocommerce, $wp;
|
global $woocommerce, $wp;
|
||||||
|
|
||||||
if ( ! empty( $wp->query_vars['order-received'] ) ) {
|
if ( ! empty( $wp->query_vars['order-received'] ) ) {
|
||||||
|
@ -142,5 +145,5 @@ function woocommerce_clear_cart_after_payment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action( 'get_header', 'woocommerce_clear_cart_after_payment' );
|
add_action( 'get_header', 'wc_clear_cart_after_payment' );
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ if ( ! function_exists( 'is_shop' ) ) {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_shop() {
|
function is_shop() {
|
||||||
return ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id( 'shop' ) ) ) ? true : false;
|
return ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ if ( ! function_exists( 'is_cart' ) ) {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_cart() {
|
function is_cart() {
|
||||||
return is_page( woocommerce_get_page_id( 'cart' ) );
|
return is_page( wc_get_page_id( 'cart' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ if ( ! function_exists( 'is_checkout' ) ) {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_checkout() {
|
function is_checkout() {
|
||||||
return is_page( woocommerce_get_page_id( 'checkout' ) ) ? true : false;
|
return is_page( wc_get_page_id( 'checkout' ) ) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ if ( ! function_exists( 'is_account_page' ) ) {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_account_page() {
|
function is_account_page() {
|
||||||
return is_page( woocommerce_get_page_id( 'myaccount' ) ) || apply_filters( 'woocommerce_is_account_page', false ) ? true : false;
|
return is_page( wc_get_page_id( 'myaccount' ) ) || apply_filters( 'woocommerce_is_account_page', false ) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ if ( ! function_exists( 'is_order_received_page' ) ) {
|
||||||
function is_order_received_page() {
|
function is_order_received_page() {
|
||||||
global $wp;
|
global $wp;
|
||||||
|
|
||||||
return ( is_page( woocommerce_get_page_id( 'checkout' ) ) && isset( $wp->query_vars['order-received'] ) ) ? true : false;
|
return ( is_page( wc_get_page_id( 'checkout' ) ) && isset( $wp->query_vars['order-received'] ) ) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ if ( ! function_exists( 'is_add_payment_method_page' ) ) {
|
||||||
function is_add_payment_method_page() {
|
function is_add_payment_method_page() {
|
||||||
global $wp;
|
global $wp;
|
||||||
|
|
||||||
return ( is_page( woocommerce_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['add-payment-method'] ) ) ? true : false;
|
return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['add-payment-method'] ) ) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ add_filter( 'woocommerce_short_description', 'do_shortcode', 11 ); // AFTER wpau
|
||||||
* @param string $name (default: '')
|
* @param string $name (default: '')
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_template_part( $slug, $name = '' ) {
|
function wc_get_template_part( $slug, $name = '' ) {
|
||||||
$template = '';
|
$template = '';
|
||||||
|
|
||||||
// Look in yourtheme/slug-name.php and yourtheme/woocommerce/slug-name.php
|
// Look in yourtheme/slug-name.php and yourtheme/woocommerce/slug-name.php
|
||||||
|
@ -81,11 +81,11 @@ function woocommerce_get_template_part( $slug, $name = '' ) {
|
||||||
* @param string $default_path (default: '')
|
* @param string $default_path (default: '')
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
|
function wc_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
|
||||||
if ( $args && is_array($args) )
|
if ( $args && is_array($args) )
|
||||||
extract( $args );
|
extract( $args );
|
||||||
|
|
||||||
$located = woocommerce_locate_template( $template_name, $template_path, $default_path );
|
$located = wc_locate_template( $template_name, $template_path, $default_path );
|
||||||
|
|
||||||
do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located, $args );
|
do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located, $args );
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ function woocommerce_get_template( $template_name, $args = array(), $template_pa
|
||||||
* @param string $default_path (default: '')
|
* @param string $default_path (default: '')
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
function wc_locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
||||||
if ( ! $template_path ) $template_path = WC()->template_path();
|
if ( ! $template_path ) $template_path = WC()->template_path();
|
||||||
if ( ! $default_path ) $default_path = WC()->plugin_path() . '/templates/';
|
if ( ! $default_path ) $default_path = WC()->plugin_path() . '/templates/';
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
|
||||||
* @param string $headers (default: "Content-Type: text/html\r\n")
|
* @param string $headers (default: "Content-Type: text/html\r\n")
|
||||||
* @param string $attachments (default: "")
|
* @param string $attachments (default: "")
|
||||||
*/
|
*/
|
||||||
function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
|
function wc_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
$mailer = WC()->mailer();
|
$mailer = WC()->mailer();
|
||||||
|
|
|
@ -21,14 +21,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
* @param bool $show_admin_bar
|
* @param bool $show_admin_bar
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_disable_admin_bar( $show_admin_bar ) {
|
function wc_disable_admin_bar( $show_admin_bar ) {
|
||||||
if ( apply_filters( 'woocommerce_disable_admin_bar', get_option( 'woocommerce_lock_down_admin', "yes" ) == "yes" ) && ! ( current_user_can('edit_posts') || current_user_can('manage_woocommerce') ) ) {
|
if ( apply_filters( 'woocommerce_disable_admin_bar', get_option( 'woocommerce_lock_down_admin', "yes" ) == "yes" ) && ! ( current_user_can('edit_posts') || current_user_can('manage_woocommerce') ) ) {
|
||||||
$show_admin_bar = false;
|
$show_admin_bar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $show_admin_bar;
|
return $show_admin_bar;
|
||||||
}
|
}
|
||||||
add_filter( 'show_admin_bar', 'woocommerce_disable_admin_bar', 10, 1 );
|
add_filter( 'show_admin_bar', 'wc_disable_admin_bar', 10, 1 );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ add_filter( 'show_admin_bar', 'woocommerce_disable_admin_bar', 10, 1 );
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @return WP_Error on failure, Int (user ID) on success
|
* @return WP_Error on failure, Int (user ID) on success
|
||||||
*/
|
*/
|
||||||
function woocommerce_create_new_customer( $email, $username = '', $password = '' ) {
|
function wc_create_new_customer( $email, $username = '', $password = '' ) {
|
||||||
|
|
||||||
// Check the e-mail address
|
// Check the e-mail address
|
||||||
if ( empty( $email ) || ! is_email( $email ) )
|
if ( empty( $email ) || ! is_email( $email ) )
|
||||||
|
@ -117,7 +117,7 @@ function woocommerce_create_new_customer( $email, $username = '', $password = ''
|
||||||
* @param int $customer_id
|
* @param int $customer_id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_set_customer_auth_cookie( $customer_id ) {
|
function wc_set_customer_auth_cookie( $customer_id ) {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
|
|
||||||
$current_user = get_user_by( 'id', $customer_id );
|
$current_user = get_user_by( 'id', $customer_id );
|
||||||
|
@ -131,7 +131,7 @@ function woocommerce_set_customer_auth_cookie( $customer_id ) {
|
||||||
* @param int $customer_id
|
* @param int $customer_id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_update_new_customer_past_orders( $customer_id ) {
|
function wc_update_new_customer_past_orders( $customer_id ) {
|
||||||
|
|
||||||
$customer = get_user_by( 'id', absint( $customer_id ) );
|
$customer = get_user_by( 'id', absint( $customer_id ) );
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ function woocommerce_update_new_customer_past_orders( $customer_id ) {
|
||||||
* @param int $order_id
|
* @param int $order_id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_paying_customer( $order_id ) {
|
function wc_paying_customer( $order_id ) {
|
||||||
|
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( $order_id );
|
||||||
|
|
||||||
|
@ -203,12 +203,10 @@ function woocommerce_paying_customer( $order_id ) {
|
||||||
update_user_meta( $order->user_id, '_order_count', $old_count + 1 );
|
update_user_meta( $order->user_id, '_order_count', $old_count + 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action( 'woocommerce_order_status_completed', 'woocommerce_paying_customer' );
|
add_action( 'woocommerce_order_status_completed', 'wc_paying_customer' );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_customer_bought_product
|
|
||||||
*
|
|
||||||
* Checks if a user (by email) has bought an item
|
* Checks if a user (by email) has bought an item
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -217,7 +215,7 @@ add_action( 'woocommerce_order_status_completed', 'woocommerce_paying_customer'
|
||||||
* @param int $product_id
|
* @param int $product_id
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) {
|
function wc_customer_bought_product( $customer_email, $user_id, $product_id ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$emails = array();
|
$emails = array();
|
||||||
|
@ -261,8 +259,6 @@ function woocommerce_customer_bought_product( $customer_email, $user_id, $produc
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_customer_has_capability
|
|
||||||
*
|
|
||||||
* Checks if a user has a certain capability
|
* Checks if a user has a certain capability
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -271,7 +267,7 @@ function woocommerce_customer_bought_product( $customer_email, $user_id, $produc
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_customer_has_capability( $allcaps, $caps, $args ) {
|
function wc_customer_has_capability( $allcaps, $caps, $args ) {
|
||||||
if ( isset( $caps[0] ) ) {
|
if ( isset( $caps[0] ) ) {
|
||||||
switch ( $caps[0] ) {
|
switch ( $caps[0] ) {
|
||||||
|
|
||||||
|
@ -323,4 +319,4 @@ function woocommerce_customer_has_capability( $allcaps, $caps, $args ) {
|
||||||
}
|
}
|
||||||
return $allcaps;
|
return $allcaps;
|
||||||
}
|
}
|
||||||
add_filter( 'user_has_cap', 'woocommerce_customer_has_capability', 10, 3);
|
add_filter( 'user_has_cap', 'wc_customer_has_capability', 10, 3);
|
|
@ -46,8 +46,8 @@ function woocommerce_readfile_chunked( $file, $retbytes = true ) {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_format_total( $number ) {
|
function woocommerce_format_total( $number ) {
|
||||||
_deprecated_function( __FUNCTION__, '2.1', 'woocommerce_format_decimal()' );
|
_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' );
|
||||||
return woocommerce_format_decimal( $number, get_option( 'woocommerce_price_num_decimals' ), false );
|
return wc_format_decimal( $number, get_option( 'woocommerce_price_num_decimals' ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,6 +79,198 @@ function woocommerce_legacy_paypal_ipn() {
|
||||||
}
|
}
|
||||||
add_action( 'init', 'woocommerce_legacy_paypal_ipn' );
|
add_action( 'init', 'woocommerce_legacy_paypal_ipn' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cart functions (soft deprecated)
|
||||||
|
*/
|
||||||
|
function woocommerce_protected_product_add_to_cart( $passed, $product_id ) {
|
||||||
|
wc_protected_product_add_to_cart( $passed, $product_id );
|
||||||
|
}
|
||||||
|
function woocommerce_empty_cart() {
|
||||||
|
wc_empty_cart();
|
||||||
|
}
|
||||||
|
function woocommerce_load_persistent_cart( $user_login, $user = 0 ) {
|
||||||
|
wc_load_persistent_cart( $user_login, $user );
|
||||||
|
}
|
||||||
|
function woocommerce_add_to_cart_message( $product_id ) {
|
||||||
|
wc_add_to_cart_message( $product_id );
|
||||||
|
}
|
||||||
|
function woocommerce_clear_cart_after_payment() {
|
||||||
|
wc_clear_cart_after_payment();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Core functions (soft deprecated)
|
||||||
|
*/
|
||||||
|
function woocommerce_get_template_part( $slug, $name = '' ) {
|
||||||
|
wc_get_template_part( $slug, $name );
|
||||||
|
}
|
||||||
|
function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
|
||||||
|
wc_get_template( $template_name, $args, $template_path, $default_path );
|
||||||
|
}
|
||||||
|
function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
||||||
|
wc_locate_template( $template_name, $template_path, $default_path );
|
||||||
|
}
|
||||||
|
function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
|
||||||
|
wc_mail( $to, $subject, $message, $headers, $attachments );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customer functions (soft deprecated)
|
||||||
|
*/
|
||||||
|
function woocommerce_disable_admin_bar( $show_admin_bar ) {
|
||||||
|
wc_disable_admin_bar( $show_admin_bar );
|
||||||
|
}
|
||||||
|
function woocommerce_create_new_customer( $email, $username = '', $password = '' ) {
|
||||||
|
wc_create_new_customer( $email, $username, $password );
|
||||||
|
}
|
||||||
|
function woocommerce_set_customer_auth_cookie( $customer_id ) {
|
||||||
|
wc_set_customer_auth_cookie( $customer_id );
|
||||||
|
}
|
||||||
|
function woocommerce_update_new_customer_past_orders( $customer_id ) {
|
||||||
|
wc_update_new_customer_past_orders( $customer_id );
|
||||||
|
}
|
||||||
|
function wc_paying_customer( $order_id ) {
|
||||||
|
woocommerce_paying_customer( $order_id );
|
||||||
|
}
|
||||||
|
function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) {
|
||||||
|
wc_customer_bought_product( $customer_email, $user_id, $product_id );
|
||||||
|
}
|
||||||
|
function woocommerce_customer_has_capability( $allcaps, $caps, $args ) {
|
||||||
|
wc_customer_has_capability( $allcaps, $caps, $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formatting functions (soft deprecated)
|
||||||
|
*/
|
||||||
|
function woocommerce_sanitize_taxonomy_name( $taxonomy ) {
|
||||||
|
wc_sanitize_taxonomy_name( $taxonomy );
|
||||||
|
}
|
||||||
|
function woocommerce_get_filename_from_url( $file_url ) {
|
||||||
|
wc_get_filename_from_url( $file_url );
|
||||||
|
}
|
||||||
|
function woocommerce_get_dimension( $dim, $to_unit ) {
|
||||||
|
wc_get_dimension( $dim, $to_unit );
|
||||||
|
}
|
||||||
|
function woocommerce_get_weight( $weight, $to_unit ) {
|
||||||
|
wc_get_weight( $weight, $to_unit );
|
||||||
|
}
|
||||||
|
function woocommerce_trim_zeros( $price ) {
|
||||||
|
wc_trim_zeros( $price );
|
||||||
|
}
|
||||||
|
function woocommerce_round_tax_total( $tax ) {
|
||||||
|
wc_round_tax_total( $tax );
|
||||||
|
}
|
||||||
|
function woocommerce_format_decimal( $number, $dp = false, $trim_zeros = false ) {
|
||||||
|
wc_format_decimal( $number, $dp, $trim_zeros );
|
||||||
|
}
|
||||||
|
function woocommerce_clean( $var ) {
|
||||||
|
wc_clean( $var );
|
||||||
|
}
|
||||||
|
function woocommerce_array_overlay( $a1, $a2 ) {
|
||||||
|
wc_array_overlay( $a1, $a2 );
|
||||||
|
}
|
||||||
|
function woocommerce_price( $price, $args = array() ) {
|
||||||
|
wc_price( $price, $args );
|
||||||
|
}
|
||||||
|
function woocommerce_let_to_num( $size ) {
|
||||||
|
wc_let_to_num( $size );
|
||||||
|
}
|
||||||
|
function woocommerce_date_format() {
|
||||||
|
wc_date_format();
|
||||||
|
}
|
||||||
|
function woocommerce_time_format() {
|
||||||
|
wc_time_format();
|
||||||
|
}
|
||||||
|
function woocommerce_timezone_string() {
|
||||||
|
wc_timezone_string();
|
||||||
|
}
|
||||||
|
if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) {
|
||||||
|
function woocommerce_rgb_from_hex( $color ) {
|
||||||
|
wc_rgb_from_hex( $color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! function_exists( 'woocommerce_hex_darker' ) ) {
|
||||||
|
function woocommerce_hex_darker( $color, $factor = 30 ) {
|
||||||
|
wc_hex_darker( $color, $factor );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! function_exists( 'woocommerce_hex_lighter' ) ) {
|
||||||
|
function woocommerce_hex_lighter( $color, $factor = 30 ) {
|
||||||
|
wc_hex_lighter( $color, $factor );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! function_exists( 'woocommerce_light_or_dark' ) ) {
|
||||||
|
function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
|
||||||
|
wc_light_or_dark( $color, $dark, $light );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! function_exists( 'woocommerce_format_hex' ) ) {
|
||||||
|
function woocommerce_format_hex( $hex ) {
|
||||||
|
wc_format_hex( $hex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order functions (soft deprecated)
|
||||||
|
*/
|
||||||
|
function woocommerce_get_order_id_by_order_key( $order_key ) {
|
||||||
|
wc_get_order_id_by_order_key( $order_key );
|
||||||
|
}
|
||||||
|
function woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) {
|
||||||
|
wc_downloadable_file_permission( $download_id, $product_id, $order );
|
||||||
|
}
|
||||||
|
function woocommerce_downloadable_product_permissions( $order_id ) {
|
||||||
|
wc_downloadable_product_permissions( $order_id );
|
||||||
|
}
|
||||||
|
function woocommerce_add_order_item( $order_id, $item ) {
|
||||||
|
wc_add_order_item( $order_id, $item );
|
||||||
|
}
|
||||||
|
function woocommerce_delete_order_item( $item_id ) {
|
||||||
|
wc_delete_order_item( $item_id );
|
||||||
|
}
|
||||||
|
function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) {
|
||||||
|
wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value );
|
||||||
|
}
|
||||||
|
function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) {
|
||||||
|
wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique );
|
||||||
|
}
|
||||||
|
function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) {
|
||||||
|
wc_delete_order_item_meta( $item_id, $meta_key, $meta_value, $delete_all );
|
||||||
|
}
|
||||||
|
function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) {
|
||||||
|
wc_get_order_item_meta( $item_id, $key, $single );
|
||||||
|
}
|
||||||
|
function woocommerce_cancel_unpaid_orders() {
|
||||||
|
wc_cancel_unpaid_orders();
|
||||||
|
}
|
||||||
|
function woocommerce_processing_order_count() {
|
||||||
|
wc_processing_order_count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page functions (soft deprecated)
|
||||||
|
*/
|
||||||
|
function woocommerce_get_page_id( $page ) {
|
||||||
|
wc_get_page_id( $page );
|
||||||
|
}
|
||||||
|
function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
|
||||||
|
wc_get_endpoint_url( $endpoint, $value, $permalink );
|
||||||
|
}
|
||||||
|
function woocommerce_lostpassword_url( $url ) {
|
||||||
|
wc_lostpassword_url( $url );
|
||||||
|
}
|
||||||
|
function woocommerce_customer_edit_account_url() {
|
||||||
|
wc_customer_edit_account_url();
|
||||||
|
}
|
||||||
|
function woocommerce_nav_menu_items( $items, $args ) {
|
||||||
|
wc_nav_menu_items( $items, $args );
|
||||||
|
}
|
||||||
|
function woocommerce_nav_menu_item_classes( $menu_items, $args ) {
|
||||||
|
wc_nav_menu_item_classes( $menu_items, $args );
|
||||||
|
}
|
||||||
|
function woocommerce_list_pages( $pages ) {
|
||||||
|
wc_list_pages( $pages );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle renamed filters
|
* Handle renamed filters
|
||||||
|
|
|
@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
* @param mixed $taxonomy
|
* @param mixed $taxonomy
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_sanitize_taxonomy_name( $taxonomy ) {
|
function wc_sanitize_taxonomy_name( $taxonomy ) {
|
||||||
$filtered = strtolower( remove_accents( stripslashes( strip_tags( $taxonomy ) ) ) );
|
$filtered = strtolower( remove_accents( stripslashes( strip_tags( $taxonomy ) ) ) );
|
||||||
$filtered = preg_replace( '/&.+?;/', '', $filtered ); // Kill entities
|
$filtered = preg_replace( '/&.+?;/', '', $filtered ); // Kill entities
|
||||||
$filtered = str_replace( array( '.', '\'', '"' ), '', $filtered ); // Kill quotes and full stops.
|
$filtered = str_replace( array( '.', '\'', '"' ), '', $filtered ); // Kill quotes and full stops.
|
||||||
|
@ -37,25 +37,23 @@ function woocommerce_sanitize_taxonomy_name( $taxonomy ) {
|
||||||
* @param string $file_url
|
* @param string $file_url
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_filename_from_url( $file_url ) {
|
function wc_get_filename_from_url( $file_url ) {
|
||||||
$parts = parse_url( $file_url );
|
$parts = parse_url( $file_url );
|
||||||
if ( isset( $parts['path'] ) )
|
if ( isset( $parts['path'] ) )
|
||||||
return basename( $parts['path'] );
|
return basename( $parts['path'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_get_dimension function.
|
|
||||||
*
|
|
||||||
* Normalise dimensions, unify to cm then convert to wanted unit value
|
* Normalise dimensions, unify to cm then convert to wanted unit value
|
||||||
*
|
*
|
||||||
* Usage: woocommerce_get_dimension(55, 'in');
|
* Usage: wc_get_dimension(55, 'in');
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $dim
|
* @param mixed $dim
|
||||||
* @param mixed $to_unit 'in', 'm', 'cm', 'm'
|
* @param mixed $to_unit 'in', 'm', 'cm', 'm'
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_dimension( $dim, $to_unit ) {
|
function wc_get_dimension( $dim, $to_unit ) {
|
||||||
|
|
||||||
$from_unit = strtolower( get_option( 'woocommerce_dimension_unit' ) );
|
$from_unit = strtolower( get_option( 'woocommerce_dimension_unit' ) );
|
||||||
$to_unit = strtolower( $to_unit );
|
$to_unit = strtolower( $to_unit );
|
||||||
|
@ -98,18 +96,16 @@ function woocommerce_get_dimension( $dim, $to_unit ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_get_weight function.
|
|
||||||
*
|
|
||||||
* Normalise weights, unify to cm then convert to wanted unit value
|
* Normalise weights, unify to cm then convert to wanted unit value
|
||||||
*
|
*
|
||||||
* Usage: woocommerce_get_weight(55, 'kg');
|
* Usage: wc_get_weight(55, 'kg');
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $weight
|
* @param mixed $weight
|
||||||
* @param mixed $to_unit 'g', 'kg', 'lbs'
|
* @param mixed $to_unit 'g', 'kg', 'lbs'
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_weight( $weight, $to_unit ) {
|
function wc_get_weight( $weight, $to_unit ) {
|
||||||
|
|
||||||
$from_unit = strtolower( get_option('woocommerce_weight_unit') );
|
$from_unit = strtolower( get_option('woocommerce_weight_unit') );
|
||||||
$to_unit = strtolower( $to_unit );
|
$to_unit = strtolower( $to_unit );
|
||||||
|
@ -152,7 +148,7 @@ function woocommerce_get_weight( $weight, $to_unit ) {
|
||||||
* @param mixed $price
|
* @param mixed $price
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_trim_zeros( $price ) {
|
function wc_trim_zeros( $price ) {
|
||||||
return preg_replace( '/' . preg_quote( get_option( 'woocommerce_price_decimal_sep' ), '/' ) . '0++$/', '', $price );
|
return preg_replace( '/' . preg_quote( get_option( 'woocommerce_price_decimal_sep' ), '/' ) . '0++$/', '', $price );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +159,7 @@ function woocommerce_trim_zeros( $price ) {
|
||||||
* @param mixed $price
|
* @param mixed $price
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_round_tax_total( $tax ) {
|
function wc_round_tax_total( $tax ) {
|
||||||
$dp = (int) get_option( 'woocommerce_price_num_decimals' );
|
$dp = (int) get_option( 'woocommerce_price_num_decimals' );
|
||||||
|
|
||||||
if ( version_compare( phpversion(), '5.3', '<' ) ) {
|
if ( version_compare( phpversion(), '5.3', '<' ) ) {
|
||||||
|
@ -184,12 +180,12 @@ function woocommerce_round_tax_total( $tax ) {
|
||||||
* @param boolean $trim_zeros from end of string
|
* @param boolean $trim_zeros from end of string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_format_decimal( $number, $dp = false, $trim_zeros = false ) {
|
function wc_format_decimal( $number, $dp = false, $trim_zeros = false ) {
|
||||||
// Remove locale from string
|
// Remove locale from string
|
||||||
if ( ! is_float( $number ) ) {
|
if ( ! is_float( $number ) ) {
|
||||||
$locale = localeconv();
|
$locale = localeconv();
|
||||||
$decimals = array( get_option( 'woocommerce_price_decimal_sep' ), $locale['decimal_point'], $locale['mon_decimal_point'] );
|
$decimals = array( get_option( 'woocommerce_price_decimal_sep' ), $locale['decimal_point'], $locale['mon_decimal_point'] );
|
||||||
$number = woocommerce_clean( str_replace( $decimals, '.', $number ) );
|
$number = wc_clean( str_replace( $decimals, '.', $number ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// DP is false - don't use number format, just return a string in our format
|
// DP is false - don't use number format, just return a string in our format
|
||||||
|
@ -246,7 +242,7 @@ function wc_format_localized_decimal( $value ) {
|
||||||
* @param string $var
|
* @param string $var
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_clean( $var ) {
|
function wc_clean( $var ) {
|
||||||
return sanitize_text_field( $var );
|
return sanitize_text_field( $var );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,12 +254,12 @@ function woocommerce_clean( $var ) {
|
||||||
* @param array $a2
|
* @param array $a2
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function woocommerce_array_overlay( $a1, $a2 ) {
|
function wc_array_overlay( $a1, $a2 ) {
|
||||||
foreach( $a1 as $k => $v ) {
|
foreach( $a1 as $k => $v ) {
|
||||||
if ( ! array_key_exists( $k, $a2 ) )
|
if ( ! array_key_exists( $k, $a2 ) )
|
||||||
continue;
|
continue;
|
||||||
if ( is_array( $v ) && is_array( $a2[ $k ] ) ) {
|
if ( is_array( $v ) && is_array( $a2[ $k ] ) ) {
|
||||||
$a1[ $k ] = woocommerce_array_overlay( $v, $a2[ $k ] );
|
$a1[ $k ] = wc_array_overlay( $v, $a2[ $k ] );
|
||||||
} else {
|
} else {
|
||||||
$a1[ $k ] = $a2[ $k ];
|
$a1[ $k ] = $a2[ $k ];
|
||||||
}
|
}
|
||||||
|
@ -305,7 +301,7 @@ function get_woocommerce_price_format() {
|
||||||
* @param array $args (default: array())
|
* @param array $args (default: array())
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_price( $price, $args = array() ) {
|
function wc_price( $price, $args = array() ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
extract( shortcode_atts( array(
|
extract( shortcode_atts( array(
|
||||||
|
@ -324,7 +320,7 @@ function woocommerce_price( $price, $args = array() ) {
|
||||||
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $num_decimals, $decimal_sep, $thousands_sep ), $price, $num_decimals, $decimal_sep, $thousands_sep );
|
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $num_decimals, $decimal_sep, $thousands_sep ), $price, $num_decimals, $decimal_sep, $thousands_sep );
|
||||||
|
|
||||||
if ( apply_filters( 'woocommerce_price_trim_zeros', true ) && $num_decimals > 0 )
|
if ( apply_filters( 'woocommerce_price_trim_zeros', true ) && $num_decimals > 0 )
|
||||||
$price = woocommerce_trim_zeros( $price );
|
$price = wc_trim_zeros( $price );
|
||||||
|
|
||||||
$return = '<span class="amount">' . sprintf( get_woocommerce_price_format(), $currency_symbol, $price ) . '</span>';
|
$return = '<span class="amount">' . sprintf( get_woocommerce_price_format(), $currency_symbol, $price ) . '</span>';
|
||||||
|
|
||||||
|
@ -343,7 +339,7 @@ function woocommerce_price( $price, $args = array() ) {
|
||||||
* @param $size
|
* @param $size
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function woocommerce_let_to_num( $size ) {
|
function wc_let_to_num( $size ) {
|
||||||
$l = substr( $size, -1 );
|
$l = substr( $size, -1 );
|
||||||
$ret = substr( $size, 0, -1 );
|
$ret = substr( $size, 0, -1 );
|
||||||
switch( strtoupper( $l ) ) {
|
switch( strtoupper( $l ) ) {
|
||||||
|
@ -367,7 +363,7 @@ function woocommerce_let_to_num( $size ) {
|
||||||
* @access public
|
* @access public
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_date_format() {
|
function wc_date_format() {
|
||||||
return apply_filters( 'woocommerce_date_format', get_option( 'date_format' ) );
|
return apply_filters( 'woocommerce_date_format', get_option( 'date_format' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +373,7 @@ function woocommerce_date_format() {
|
||||||
* @access public
|
* @access public
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_time_format() {
|
function wc_time_format() {
|
||||||
return apply_filters( 'woocommerce_time_format', get_option( 'time_format' ) );
|
return apply_filters( 'woocommerce_time_format', get_option( 'time_format' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +387,7 @@ function woocommerce_time_format() {
|
||||||
* @access public
|
* @access public
|
||||||
* @return string a valid PHP timezone string for the site
|
* @return string a valid PHP timezone string for the site
|
||||||
*/
|
*/
|
||||||
function woocommerce_timezone_string() {
|
function wc_timezone_string() {
|
||||||
|
|
||||||
// if site timezone string exists, return it
|
// if site timezone string exists, return it
|
||||||
if ( $timezone = get_option( 'timezone_string' ) )
|
if ( $timezone = get_option( 'timezone_string' ) )
|
||||||
|
@ -426,7 +422,7 @@ function woocommerce_timezone_string() {
|
||||||
return 'UTC';
|
return 'UTC';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) {
|
if ( ! function_exists( 'wc_rgb_from_hex' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hex darker/lighter/contrast functions for colours
|
* Hex darker/lighter/contrast functions for colours
|
||||||
|
@ -435,7 +431,7 @@ if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) {
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_rgb_from_hex( $color ) {
|
function wc_rgb_from_hex( $color ) {
|
||||||
$color = str_replace( '#', '', $color );
|
$color = str_replace( '#', '', $color );
|
||||||
// Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
|
// Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
|
||||||
$color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
|
$color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
|
||||||
|
@ -447,7 +443,7 @@ if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists( 'woocommerce_hex_darker' ) ) {
|
if ( ! function_exists( 'wc_hex_darker' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hex darker/lighter/contrast functions for colours
|
* Hex darker/lighter/contrast functions for colours
|
||||||
|
@ -457,8 +453,8 @@ if ( ! function_exists( 'woocommerce_hex_darker' ) ) {
|
||||||
* @param int $factor (default: 30)
|
* @param int $factor (default: 30)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_hex_darker( $color, $factor = 30 ) {
|
function wc_hex_darker( $color, $factor = 30 ) {
|
||||||
$base = woocommerce_rgb_from_hex( $color );
|
$base = wc_rgb_from_hex( $color );
|
||||||
$color = '#';
|
$color = '#';
|
||||||
|
|
||||||
foreach ($base as $k => $v) :
|
foreach ($base as $k => $v) :
|
||||||
|
@ -477,7 +473,7 @@ if ( ! function_exists( 'woocommerce_hex_darker' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists( 'woocommerce_hex_lighter' ) ) {
|
if ( ! function_exists( 'wc_hex_lighter' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hex darker/lighter/contrast functions for colours
|
* Hex darker/lighter/contrast functions for colours
|
||||||
|
@ -487,8 +483,8 @@ if ( ! function_exists( 'woocommerce_hex_lighter' ) ) {
|
||||||
* @param int $factor (default: 30)
|
* @param int $factor (default: 30)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_hex_lighter( $color, $factor = 30 ) {
|
function wc_hex_lighter( $color, $factor = 30 ) {
|
||||||
$base = woocommerce_rgb_from_hex( $color );
|
$base = wc_rgb_from_hex( $color );
|
||||||
$color = '#';
|
$color = '#';
|
||||||
|
|
||||||
foreach ($base as $k => $v) :
|
foreach ($base as $k => $v) :
|
||||||
|
@ -508,7 +504,7 @@ if ( ! function_exists( 'woocommerce_hex_lighter' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists( 'woocommerce_light_or_dark' ) ) {
|
if ( ! function_exists( 'wc_light_or_dark' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect if we should use a light or dark colour on a background colour
|
* Detect if we should use a light or dark colour on a background colour
|
||||||
|
@ -519,7 +515,7 @@ if ( ! function_exists( 'woocommerce_light_or_dark' ) ) {
|
||||||
* @param string $light (default: '#FFFFFF')
|
* @param string $light (default: '#FFFFFF')
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
|
function wc_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
|
||||||
//return ( hexdec( $color ) > 0xffffff / 2 ) ? $dark : $light;
|
//return ( hexdec( $color ) > 0xffffff / 2 ) ? $dark : $light;
|
||||||
$hex = str_replace( '#', '', $color );
|
$hex = str_replace( '#', '', $color );
|
||||||
|
|
||||||
|
@ -532,7 +528,7 @@ if ( ! function_exists( 'woocommerce_light_or_dark' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists( 'woocommerce_format_hex' ) ) {
|
if ( ! function_exists( 'wc_format_hex' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format string as hex
|
* Format string as hex
|
||||||
|
@ -541,7 +537,7 @@ if ( ! function_exists( 'woocommerce_format_hex' ) ) {
|
||||||
* @param string $hex
|
* @param string $hex
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_format_hex( $hex ) {
|
function wc_format_hex( $hex ) {
|
||||||
|
|
||||||
$hex = trim( str_replace( '#', '', $hex ) );
|
$hex = trim( str_replace( '#', '', $hex ) );
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ function wc_print_notices() {
|
||||||
|
|
||||||
foreach ( $notice_types as $notice_type ) {
|
foreach ( $notice_types as $notice_type ) {
|
||||||
if ( wc_notice_count( $notice_type ) > 0 ) {
|
if ( wc_notice_count( $notice_type ) > 0 ) {
|
||||||
woocommerce_get_template( "notices/{$notice_type}.php", array(
|
wc_get_template( "notices/{$notice_type}.php", array(
|
||||||
'messages' => $all_notices[$notice_type]
|
'messages' => $all_notices[$notice_type]
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ function wc_print_notice( $message, $notice_type = 'success' ) {
|
||||||
if ( 'success' === $notice_type )
|
if ( 'success' === $notice_type )
|
||||||
$message = apply_filters( 'woocommerce_add_message', $message );
|
$message = apply_filters( 'woocommerce_add_message', $message );
|
||||||
|
|
||||||
woocommerce_get_template( "notices/{$notice_type}.php", array(
|
wc_get_template( "notices/{$notice_type}.php", array(
|
||||||
'messages' => array( apply_filters( 'woocommerce_add_' . $notice_type, $message ) )
|
'messages' => array( apply_filters( 'woocommerce_add_' . $notice_type, $message ) )
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
* @param string $order_key An order key has generated by
|
* @param string $order_key An order key has generated by
|
||||||
* @return int The ID of an order, or 0 if the order could not be found
|
* @return int The ID of an order, or 0 if the order could not be found
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_order_id_by_order_key( $order_key ) {
|
function wc_get_order_id_by_order_key( $order_key ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
// Faster than get_posts()
|
// Faster than get_posts()
|
||||||
|
@ -37,7 +37,7 @@ function woocommerce_get_order_id_by_order_key( $order_key ) {
|
||||||
* @param WC_Order $order the order
|
* @param WC_Order $order the order
|
||||||
* @return int insert id | bool false on failure
|
* @return int insert id | bool false on failure
|
||||||
*/
|
*/
|
||||||
function woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) {
|
function wc_downloadable_file_permission( $download_id, $product_id, $order ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
if ( $order->status == 'processing' && get_option( 'woocommerce_downloads_grant_access_after_payment' ) == 'no' )
|
if ( $order->status == 'processing' && get_option( 'woocommerce_downloads_grant_access_after_payment' ) == 'no' )
|
||||||
|
@ -105,7 +105,7 @@ add_action('woocommerce_order_status_processing', 'woocommerce_downloadable_prod
|
||||||
* @param int $order_id
|
* @param int $order_id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_downloadable_product_permissions( $order_id ) {
|
function wc_downloadable_product_permissions( $order_id ) {
|
||||||
if ( get_post_meta( $order_id, '_download_permissions_granted', true ) == 1 )
|
if ( get_post_meta( $order_id, '_download_permissions_granted', true ) == 1 )
|
||||||
return; // Only do this once
|
return; // Only do this once
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ function woocommerce_downloadable_product_permissions( $order_id ) {
|
||||||
$downloads = get_post_meta( $_product->id, '_downloadable_files' ) ;
|
$downloads = get_post_meta( $_product->id, '_downloadable_files' ) ;
|
||||||
|
|
||||||
foreach ( $downloads[0] as $download_id => $download )
|
foreach ( $downloads[0] as $download_id => $download )
|
||||||
woocommerce_downloadable_file_permission( $download_id, $item['variation_id'] > 0 ? $item['variation_id'] : $item['product_id'], $order );
|
wc_downloadable_file_permission( $download_id, $item['variation_id'] > 0 ? $item['variation_id'] : $item['product_id'], $order );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ function woocommerce_downloadable_product_permissions( $order_id ) {
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function woocommerce_add_order_item( $order_id, $item ) {
|
function wc_add_order_item( $order_id, $item ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$order_id = absint( $order_id );
|
$order_id = absint( $order_id );
|
||||||
|
@ -173,13 +173,13 @@ function woocommerce_add_order_item( $order_id, $item ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_delete_order_item function.
|
* Delete an item from the order it belongs to based on item id
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param int $item_id
|
* @param int $item_id
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_delete_order_item( $item_id ) {
|
function wc_delete_order_item( $item_id ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$item_id = absint( $item_id );
|
$item_id = absint( $item_id );
|
||||||
|
@ -207,7 +207,7 @@ function woocommerce_delete_order_item( $item_id ) {
|
||||||
* @param string $prev_value (default: '')
|
* @param string $prev_value (default: '')
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) {
|
function wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) {
|
||||||
return update_metadata( 'order_item', $item_id, $meta_key, $meta_value, $prev_value );
|
return update_metadata( 'order_item', $item_id, $meta_key, $meta_value, $prev_value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $
|
||||||
* @param bool $unique (default: false)
|
* @param bool $unique (default: false)
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ){
|
function wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) {
|
||||||
return add_metadata( 'order_item', $item_id, $meta_key, $meta_value, $unique );
|
return add_metadata( 'order_item', $item_id, $meta_key, $meta_value, $unique );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $uni
|
||||||
* @param bool $delete_all (default: false)
|
* @param bool $delete_all (default: false)
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) {
|
function wc_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) {
|
||||||
return delete_metadata( 'order_item', $item_id, $meta_key, $meta_value, $delete_all );
|
return delete_metadata( 'order_item', $item_id, $meta_key, $meta_value, $delete_all );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,17 +248,17 @@ function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value =
|
||||||
* @param bool $single (default: true)
|
* @param bool $single (default: true)
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) {
|
function wc_get_order_item_meta( $item_id, $key, $single = true ) {
|
||||||
return get_metadata( 'order_item', $item_id, $key, $single );
|
return get_metadata( 'order_item', $item_id, $key, $single );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_cancel_unpaid_orders function.
|
* Cancel all unpaid orders after held duration to prevent stock lock for those products
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_cancel_unpaid_orders() {
|
function wc_cancel_unpaid_orders() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$held_duration = get_option( 'woocommerce_hold_stock_minutes' );
|
$held_duration = get_option( 'woocommerce_hold_stock_minutes' );
|
||||||
|
@ -292,9 +292,9 @@ function woocommerce_cancel_unpaid_orders() {
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
|
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
|
||||||
wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
|
wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'wc_cancel_unpaid_orders' );
|
||||||
}
|
}
|
||||||
add_action( 'woocommerce_cancel_unpaid_orders', 'woocommerce_cancel_unpaid_orders' );
|
add_action( 'woocommerce_cancel_unpaid_orders', 'wc_cancel_unpaid_orders' );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -303,7 +303,7 @@ add_action( 'woocommerce_cancel_unpaid_orders', 'woocommerce_cancel_unpaid_order
|
||||||
* @access public
|
* @access public
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function woocommerce_processing_order_count() {
|
function wc_processing_order_count() {
|
||||||
if ( false === ( $order_count = get_transient( 'woocommerce_processing_order_count' ) ) ) {
|
if ( false === ( $order_count = get_transient( 'woocommerce_processing_order_count' ) ) ) {
|
||||||
$order_statuses = get_terms( 'shop_order_status' );
|
$order_statuses = get_terms( 'shop_order_status' );
|
||||||
$order_count = false;
|
$order_count = false;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* @param string $page
|
* @param string $page
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_page_id( $page ) {
|
function wc_get_page_id( $page ) {
|
||||||
|
|
||||||
if ( $page == 'pay' || $page == 'thanks' ) {
|
if ( $page == 'pay' || $page == 'thanks' ) {
|
||||||
_deprecated_argument( __FUNCTION__, '2.1', 'The "pay" and "thanks" pages are no-longer used - an endpoint is added to the checkout instead. To get a valid link use the WC_Order::get_checkout_payment_url() or WC_Order::get_checkout_order_received_url() methods instead.' );
|
_deprecated_argument( __FUNCTION__, '2.1', 'The "pay" and "thanks" pages are no-longer used - an endpoint is added to the checkout instead. To get a valid link use the WC_Order::get_checkout_payment_url() or WC_Order::get_checkout_order_received_url() methods instead.' );
|
||||||
|
@ -24,7 +24,7 @@ function woocommerce_get_page_id( $page ) {
|
||||||
$page = 'checkout';
|
$page = 'checkout';
|
||||||
}
|
}
|
||||||
if ( $page == 'change_password' || $page == 'edit_address' || $page == 'lost_password' ) {
|
if ( $page == 'change_password' || $page == 'edit_address' || $page == 'lost_password' ) {
|
||||||
_deprecated_argument( __FUNCTION__, '2.1', 'The "change_password", "edit_address" and "lost_password" pages are no-longer used - an endpoint is added to the my-account instead. To get a valid link use the woocommerce_customer_edit_account_url() function instead.' );
|
_deprecated_argument( __FUNCTION__, '2.1', 'The "change_password", "edit_address" and "lost_password" pages are no-longer used - an endpoint is added to the my-account instead. To get a valid link use the wc_customer_edit_account_url() function instead.' );
|
||||||
|
|
||||||
$page = 'myaccount';
|
$page = 'myaccount';
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ function woocommerce_get_page_id( $page ) {
|
||||||
* @param string $page
|
* @param string $page
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
|
function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
|
||||||
if ( ! $permalink )
|
if ( ! $permalink )
|
||||||
$permalink = get_permalink();
|
$permalink = get_permalink();
|
||||||
|
|
||||||
|
@ -58,16 +58,16 @@ function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' )
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* woocommerce_lostpassword_url function.
|
* Returns the url to the lost password endpoint url
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param mixed $url
|
* @param mixed $url
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_lostpassword_url( $url ) {
|
function wc_lostpassword_url( $url ) {
|
||||||
return woocommerce_get_endpoint_url( 'lost-password', '', get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
return wc_get_endpoint_url( 'lost-password', '', get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
}
|
}
|
||||||
add_filter( 'lostpassword_url', 'woocommerce_lostpassword_url' );
|
add_filter( 'lostpassword_url', 'wc_lostpassword_url' );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,8 +75,8 @@ add_filter( 'lostpassword_url', 'woocommerce_lostpassword_url' );
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_customer_edit_account_url() {
|
function wc_customer_edit_account_url() {
|
||||||
$edit_account_url = woocommerce_get_endpoint_url( 'edit-account', '', get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
|
$edit_account_url = wc_get_endpoint_url( 'edit-account', '', get_permalink( wc_get_page_id( 'myaccount' ) ) );
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_customer_edit_account_url', $edit_account_url );
|
return apply_filters( 'woocommerce_customer_edit_account_url', $edit_account_url );
|
||||||
}
|
}
|
||||||
|
@ -88,11 +88,11 @@ function woocommerce_customer_edit_account_url() {
|
||||||
* @param mixed $args
|
* @param mixed $args
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function woocommerce_nav_menu_items( $items, $args ) {
|
function wc_nav_menu_items( $items, $args ) {
|
||||||
if ( ! is_user_logged_in() ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
|
|
||||||
$hide_pages = array();
|
$hide_pages = array();
|
||||||
$hide_pages[] = (int) woocommerce_get_page_id( 'logout' );
|
$hide_pages[] = (int) wc_get_page_id( 'logout' );
|
||||||
$hide_pages = apply_filters( 'woocommerce_logged_out_hidden_page_ids', $hide_pages );
|
$hide_pages = apply_filters( 'woocommerce_logged_out_hidden_page_ids', $hide_pages );
|
||||||
|
|
||||||
foreach ( $items as $key => $item ) {
|
foreach ( $items as $key => $item ) {
|
||||||
|
@ -102,7 +102,7 @@ function woocommerce_nav_menu_items( $items, $args ) {
|
||||||
}
|
}
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_items', 10, 2 );
|
add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_items', 10, 2 );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,11 +112,11 @@ add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_items', 10, 2 );
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function woocommerce_nav_menu_item_classes( $menu_items, $args ) {
|
function wc_nav_menu_item_classes( $menu_items, $args ) {
|
||||||
|
|
||||||
if ( ! is_woocommerce() ) return $menu_items;
|
if ( ! is_woocommerce() ) return $menu_items;
|
||||||
|
|
||||||
$shop_page = (int) woocommerce_get_page_id('shop');
|
$shop_page = (int) wc_get_page_id('shop');
|
||||||
$page_for_posts = (int) get_option( 'page_for_posts' );
|
$page_for_posts = (int) get_option( 'page_for_posts' );
|
||||||
|
|
||||||
foreach ( (array) $menu_items as $key => $menu_item ) {
|
foreach ( (array) $menu_items as $key => $menu_item ) {
|
||||||
|
@ -150,7 +150,7 @@ function woocommerce_nav_menu_item_classes( $menu_items, $args ) {
|
||||||
|
|
||||||
return $menu_items;
|
return $menu_items;
|
||||||
}
|
}
|
||||||
add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 );
|
add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_item_classes', 2, 20 );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,12 +162,12 @@ add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 )
|
||||||
* @param string $pages
|
* @param string $pages
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function woocommerce_list_pages( $pages ){
|
function wc_list_pages( $pages ) {
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
if (is_woocommerce()) {
|
if (is_woocommerce()) {
|
||||||
$pages = str_replace( 'current_page_parent', '', $pages); // remove current_page_parent class from any item
|
$pages = str_replace( 'current_page_parent', '', $pages); // remove current_page_parent class from any item
|
||||||
$shop_page = 'page-item-' . woocommerce_get_page_id('shop'); // find shop_page_id through woocommerce options
|
$shop_page = 'page-item-' . wc_get_page_id('shop'); // find shop_page_id through woocommerce options
|
||||||
|
|
||||||
if (is_shop()) :
|
if (is_shop()) :
|
||||||
$pages = str_replace($shop_page, $shop_page . ' current_page_item', $pages); // add current_page_item class to shop page
|
$pages = str_replace($shop_page, $shop_page . ' current_page_item', $pages); // add current_page_item class to shop page
|
||||||
|
@ -177,4 +177,4 @@ function woocommerce_list_pages( $pages ){
|
||||||
}
|
}
|
||||||
return $pages;
|
return $pages;
|
||||||
}
|
}
|
||||||
add_filter( 'wp_list_pages', 'woocommerce_list_pages' );
|
add_filter( 'wp_list_pages', 'wc_list_pages' );
|
||||||
|
|
|
@ -21,20 +21,20 @@ function wc_template_redirect() {
|
||||||
global $wp_query, $wp;
|
global $wp_query, $wp;
|
||||||
|
|
||||||
// When default permalinks are enabled, redirect shop page to post type archive url
|
// When default permalinks are enabled, redirect shop page to post type archive url
|
||||||
if ( ! empty( $_GET['page_id'] ) && get_option( 'permalink_structure' ) == "" && $_GET['page_id'] == woocommerce_get_page_id( 'shop' ) ) {
|
if ( ! empty( $_GET['page_id'] ) && get_option( 'permalink_structure' ) == "" && $_GET['page_id'] == wc_get_page_id( 'shop' ) ) {
|
||||||
wp_safe_redirect( get_post_type_archive_link('product') );
|
wp_safe_redirect( get_post_type_archive_link('product') );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When on the checkout with an empty cart, redirect to cart page
|
// When on the checkout with an empty cart, redirect to cart page
|
||||||
elseif ( is_page( woocommerce_get_page_id( 'checkout' ) ) && sizeof( WC()->cart->get_cart() ) == 0 && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
|
elseif ( is_page( wc_get_page_id( 'checkout' ) ) && sizeof( WC()->cart->get_cart() ) == 0 && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
|
||||||
wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) );
|
wp_redirect( get_permalink( wc_get_page_id( 'cart' ) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logout
|
// Logout
|
||||||
elseif ( isset( $wp->query_vars['customer-logout'] ) ) {
|
elseif ( isset( $wp->query_vars['customer-logout'] ) ) {
|
||||||
wp_redirect( str_replace( '&', '&', wp_logout_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) ) );
|
wp_redirect( str_replace( '&', '&', wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ if ( ! function_exists( 'woocommerce_content' ) ) {
|
||||||
|
|
||||||
while ( have_posts() ) : the_post();
|
while ( have_posts() ) : the_post();
|
||||||
|
|
||||||
woocommerce_get_template_part( 'content', 'single-product' );
|
wc_get_template_part( 'content', 'single-product' );
|
||||||
|
|
||||||
endwhile;
|
endwhile;
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ if ( ! function_exists( 'woocommerce_content' ) ) {
|
||||||
|
|
||||||
<?php while ( have_posts() ) : the_post(); ?>
|
<?php while ( have_posts() ) : the_post(); ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template_part( 'content', 'product' ); ?>
|
<?php wc_get_template_part( 'content', 'product' ); ?>
|
||||||
|
|
||||||
<?php endwhile; // end of the loop. ?>
|
<?php endwhile; // end of the loop. ?>
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ if ( ! function_exists( 'woocommerce_content' ) ) {
|
||||||
|
|
||||||
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
|
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
|
||||||
|
|
||||||
<?php woocommerce_get_template( 'loop/no-products-found.php' ); ?>
|
<?php wc_get_template( 'loop/no-products-found.php' ); ?>
|
||||||
|
|
||||||
<?php endif;
|
<?php endif;
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ if ( ! function_exists( 'woocommerce_output_content_wrapper' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_output_content_wrapper() {
|
function woocommerce_output_content_wrapper() {
|
||||||
woocommerce_get_template( 'shop/wrapper-start.php' );
|
wc_get_template( 'shop/wrapper-start.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_output_content_wrapper_end' ) ) {
|
if ( ! function_exists( 'woocommerce_output_content_wrapper_end' ) ) {
|
||||||
|
@ -316,7 +316,7 @@ if ( ! function_exists( 'woocommerce_output_content_wrapper_end' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_output_content_wrapper_end() {
|
function woocommerce_output_content_wrapper_end() {
|
||||||
woocommerce_get_template( 'shop/wrapper-end.php' );
|
wc_get_template( 'shop/wrapper-end.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ if ( ! function_exists( 'woocommerce_get_sidebar' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_sidebar() {
|
function woocommerce_get_sidebar() {
|
||||||
woocommerce_get_template( 'shop/sidebar.php' );
|
wc_get_template( 'shop/sidebar.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ if ( ! function_exists( 'woocommerce_page_title' ) ) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$shop_page_id = woocommerce_get_page_id( 'shop' );
|
$shop_page_id = wc_get_page_id( 'shop' );
|
||||||
$page_title = get_the_title( $shop_page_id );
|
$page_title = get_the_title( $shop_page_id );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ if ( ! function_exists( 'woocommerce_product_loop_start' ) ) {
|
||||||
*/
|
*/
|
||||||
function woocommerce_product_loop_start( $echo = true ) {
|
function woocommerce_product_loop_start( $echo = true ) {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_get_template( 'loop/loop-start.php' );
|
wc_get_template( 'loop/loop-start.php' );
|
||||||
if ( $echo )
|
if ( $echo )
|
||||||
echo ob_get_clean();
|
echo ob_get_clean();
|
||||||
else
|
else
|
||||||
|
@ -419,7 +419,7 @@ if ( ! function_exists( 'woocommerce_product_loop_end' ) ) {
|
||||||
function woocommerce_product_loop_end( $echo = true ) {
|
function woocommerce_product_loop_end( $echo = true ) {
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
woocommerce_get_template( 'loop/loop-end.php' );
|
wc_get_template( 'loop/loop-end.php' );
|
||||||
|
|
||||||
if ( $echo )
|
if ( $echo )
|
||||||
echo ob_get_clean();
|
echo ob_get_clean();
|
||||||
|
@ -456,7 +456,7 @@ if ( ! function_exists( 'woocommerce_product_archive_description' ) ) {
|
||||||
*/
|
*/
|
||||||
function woocommerce_product_archive_description() {
|
function woocommerce_product_archive_description() {
|
||||||
if ( is_post_type_archive( 'product' ) && get_query_var( 'paged' ) == 0 ) {
|
if ( is_post_type_archive( 'product' ) && get_query_var( 'paged' ) == 0 ) {
|
||||||
$shop_page = get_post( woocommerce_get_page_id( 'shop' ) );
|
$shop_page = get_post( wc_get_page_id( 'shop' ) );
|
||||||
if ( $shop_page ) {
|
if ( $shop_page ) {
|
||||||
$description = apply_filters( 'the_content', $shop_page->post_content );
|
$description = apply_filters( 'the_content', $shop_page->post_content );
|
||||||
if ( $description ) {
|
if ( $description ) {
|
||||||
|
@ -477,7 +477,7 @@ if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_loop_add_to_cart() {
|
function woocommerce_template_loop_add_to_cart() {
|
||||||
woocommerce_get_template( 'loop/add-to-cart.php' );
|
wc_get_template( 'loop/add-to-cart.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
|
if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
|
||||||
|
@ -503,7 +503,7 @@ if ( ! function_exists( 'woocommerce_template_loop_price' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_loop_price() {
|
function woocommerce_template_loop_price() {
|
||||||
woocommerce_get_template( 'loop/price.php' );
|
wc_get_template( 'loop/price.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_loop_rating' ) ) {
|
if ( ! function_exists( 'woocommerce_template_loop_rating' ) ) {
|
||||||
|
@ -516,7 +516,7 @@ if ( ! function_exists( 'woocommerce_template_loop_rating' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_loop_rating() {
|
function woocommerce_template_loop_rating() {
|
||||||
woocommerce_get_template( 'loop/rating.php' );
|
wc_get_template( 'loop/rating.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) {
|
if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) {
|
||||||
|
@ -529,7 +529,7 @@ if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_show_product_loop_sale_flash() {
|
function woocommerce_show_product_loop_sale_flash() {
|
||||||
woocommerce_get_template( 'loop/sale-flash.php' );
|
wc_get_template( 'loop/sale-flash.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@ if ( ! function_exists( 'woocommerce_result_count' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_result_count() {
|
function woocommerce_result_count() {
|
||||||
woocommerce_get_template( 'loop/result-count.php' );
|
wc_get_template( 'loop/result-count.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,9 +625,9 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_catalog_ordering() {
|
function woocommerce_catalog_ordering() {
|
||||||
$orderby = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
$orderby = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
||||||
|
|
||||||
woocommerce_get_template( 'loop/orderby.php', array( 'orderby' => $orderby ) );
|
wc_get_template( 'loop/orderby.php', array( 'orderby' => $orderby ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ if ( ! function_exists( 'woocommerce_pagination' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_pagination() {
|
function woocommerce_pagination() {
|
||||||
woocommerce_get_template( 'loop/pagination.php' );
|
wc_get_template( 'loop/pagination.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,7 +657,7 @@ if ( ! function_exists( 'woocommerce_show_product_images' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_show_product_images() {
|
function woocommerce_show_product_images() {
|
||||||
woocommerce_get_template( 'single-product/product-image.php' );
|
wc_get_template( 'single-product/product-image.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
||||||
|
@ -670,7 +670,7 @@ if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_show_product_thumbnails() {
|
function woocommerce_show_product_thumbnails() {
|
||||||
woocommerce_get_template( 'single-product/product-thumbnails.php' );
|
wc_get_template( 'single-product/product-thumbnails.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) {
|
if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) {
|
||||||
|
@ -683,7 +683,7 @@ if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_output_product_data_tabs() {
|
function woocommerce_output_product_data_tabs() {
|
||||||
woocommerce_get_template( 'single-product/tabs/tabs.php' );
|
wc_get_template( 'single-product/tabs/tabs.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_single_title' ) ) {
|
if ( ! function_exists( 'woocommerce_template_single_title' ) ) {
|
||||||
|
@ -696,7 +696,7 @@ if ( ! function_exists( 'woocommerce_template_single_title' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_single_title() {
|
function woocommerce_template_single_title() {
|
||||||
woocommerce_get_template( 'single-product/title.php' );
|
wc_get_template( 'single-product/title.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_single_rating' ) ) {
|
if ( ! function_exists( 'woocommerce_template_single_rating' ) ) {
|
||||||
|
@ -709,7 +709,7 @@ if ( ! function_exists( 'woocommerce_template_single_rating' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_single_rating() {
|
function woocommerce_template_single_rating() {
|
||||||
woocommerce_get_template( 'single-product/rating.php' );
|
wc_get_template( 'single-product/rating.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_single_price' ) ) {
|
if ( ! function_exists( 'woocommerce_template_single_price' ) ) {
|
||||||
|
@ -722,7 +722,7 @@ if ( ! function_exists( 'woocommerce_template_single_price' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_single_price() {
|
function woocommerce_template_single_price() {
|
||||||
woocommerce_get_template( 'single-product/price.php' );
|
wc_get_template( 'single-product/price.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) {
|
if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) {
|
||||||
|
@ -735,7 +735,7 @@ if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_single_excerpt() {
|
function woocommerce_template_single_excerpt() {
|
||||||
woocommerce_get_template( 'single-product/short-description.php' );
|
wc_get_template( 'single-product/short-description.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_single_meta' ) ) {
|
if ( ! function_exists( 'woocommerce_template_single_meta' ) ) {
|
||||||
|
@ -748,7 +748,7 @@ if ( ! function_exists( 'woocommerce_template_single_meta' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_single_meta() {
|
function woocommerce_template_single_meta() {
|
||||||
woocommerce_get_template( 'single-product/meta.php' );
|
wc_get_template( 'single-product/meta.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) {
|
if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) {
|
||||||
|
@ -761,7 +761,7 @@ if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_template_single_sharing() {
|
function woocommerce_template_single_sharing() {
|
||||||
woocommerce_get_template( 'single-product/share.php' );
|
wc_get_template( 'single-product/share.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) {
|
if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) {
|
||||||
|
@ -774,7 +774,7 @@ if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_show_product_sale_flash() {
|
function woocommerce_show_product_sale_flash() {
|
||||||
woocommerce_get_template( 'single-product/sale-flash.php' );
|
wc_get_template( 'single-product/sale-flash.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +802,7 @@ if ( ! function_exists( 'woocommerce_simple_add_to_cart' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_simple_add_to_cart() {
|
function woocommerce_simple_add_to_cart() {
|
||||||
woocommerce_get_template( 'single-product/add-to-cart/simple.php' );
|
wc_get_template( 'single-product/add-to-cart/simple.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) {
|
if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) {
|
||||||
|
@ -817,7 +817,7 @@ if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) {
|
||||||
function woocommerce_grouped_add_to_cart() {
|
function woocommerce_grouped_add_to_cart() {
|
||||||
global $product;
|
global $product;
|
||||||
|
|
||||||
woocommerce_get_template( 'single-product/add-to-cart/grouped.php', array(
|
wc_get_template( 'single-product/add-to-cart/grouped.php', array(
|
||||||
'grouped_product' => $product,
|
'grouped_product' => $product,
|
||||||
'grouped_products' => $product->get_children(),
|
'grouped_products' => $product->get_children(),
|
||||||
'quantites_required' => false
|
'quantites_required' => false
|
||||||
|
@ -840,7 +840,7 @@ if ( ! function_exists( 'woocommerce_variable_add_to_cart' ) ) {
|
||||||
wp_enqueue_script( 'wc-add-to-cart-variation' );
|
wp_enqueue_script( 'wc-add-to-cart-variation' );
|
||||||
|
|
||||||
// Load the template
|
// Load the template
|
||||||
woocommerce_get_template( 'single-product/add-to-cart/variable.php', array(
|
wc_get_template( 'single-product/add-to-cart/variable.php', array(
|
||||||
'available_variations' => $product->get_available_variations(),
|
'available_variations' => $product->get_available_variations(),
|
||||||
'attributes' => $product->get_variation_attributes(),
|
'attributes' => $product->get_variation_attributes(),
|
||||||
'selected_attributes' => $product->get_variation_default_attributes()
|
'selected_attributes' => $product->get_variation_default_attributes()
|
||||||
|
@ -862,7 +862,7 @@ if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) {
|
||||||
if ( ! $product->get_product_url() )
|
if ( ! $product->get_product_url() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
woocommerce_get_template( 'single-product/add-to-cart/external.php', array(
|
wc_get_template( 'single-product/add-to-cart/external.php', array(
|
||||||
'product_url' => $product->get_product_url(),
|
'product_url' => $product->get_product_url(),
|
||||||
'button_text' => $product->single_add_to_cart_text()
|
'button_text' => $product->single_add_to_cart_text()
|
||||||
) );
|
) );
|
||||||
|
@ -891,7 +891,7 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
|
||||||
|
|
||||||
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
|
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
|
||||||
|
|
||||||
woocommerce_get_template( 'single-product/add-to-cart/quantity.php', $args );
|
wc_get_template( 'single-product/add-to-cart/quantity.php', $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,7 +905,7 @@ if ( ! function_exists( 'woocommerce_product_description_tab' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_product_description_tab() {
|
function woocommerce_product_description_tab() {
|
||||||
woocommerce_get_template( 'single-product/tabs/description.php' );
|
wc_get_template( 'single-product/tabs/description.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_product_additional_information_tab' ) ) {
|
if ( ! function_exists( 'woocommerce_product_additional_information_tab' ) ) {
|
||||||
|
@ -918,7 +918,7 @@ if ( ! function_exists( 'woocommerce_product_additional_information_tab' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_product_additional_information_tab() {
|
function woocommerce_product_additional_information_tab() {
|
||||||
woocommerce_get_template( 'single-product/tabs/additional-information.php' );
|
wc_get_template( 'single-product/tabs/additional-information.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) {
|
if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) {
|
||||||
|
@ -931,7 +931,7 @@ if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_product_reviews_tab() {
|
function woocommerce_product_reviews_tab() {
|
||||||
woocommerce_get_template( 'single-product/tabs/reviews.php' );
|
wc_get_template( 'single-product/tabs/reviews.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,7 +1018,7 @@ if ( ! function_exists( 'woocommerce_comments' ) ) {
|
||||||
*/
|
*/
|
||||||
function woocommerce_comments( $comment, $args, $depth ) {
|
function woocommerce_comments( $comment, $args, $depth ) {
|
||||||
$GLOBALS['comment'] = $comment;
|
$GLOBALS['comment'] = $comment;
|
||||||
woocommerce_get_template( 'single-product/review.php', array( 'comment' => $comment, 'args' => $args, 'depth' => $depth ) );
|
wc_get_template( 'single-product/review.php', array( 'comment' => $comment, 'args' => $args, 'depth' => $depth ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,7 +1075,7 @@ if ( ! function_exists( 'woocommerce_related_products' ) ) {
|
||||||
|
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
woocommerce_get_template( 'single-product/related.php', $args );
|
wc_get_template( 'single-product/related.php', $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,7 +1091,7 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) {
|
function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) {
|
||||||
woocommerce_get_template( 'single-product/up-sells.php', array(
|
wc_get_template( 'single-product/up-sells.php', array(
|
||||||
'posts_per_page' => $posts_per_page,
|
'posts_per_page' => $posts_per_page,
|
||||||
'orderby' => apply_filters( 'woocommerce_upsells_orderby', $orderby ),
|
'orderby' => apply_filters( 'woocommerce_upsells_orderby', $orderby ),
|
||||||
'columns' => $columns
|
'columns' => $columns
|
||||||
|
@ -1111,7 +1111,7 @@ if ( ! function_exists( 'woocommerce_shipping_calculator' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_shipping_calculator() {
|
function woocommerce_shipping_calculator() {
|
||||||
woocommerce_get_template( 'cart/shipping-calculator.php' );
|
wc_get_template( 'cart/shipping-calculator.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,7 +1125,7 @@ if ( ! function_exists( 'woocommerce_cart_totals' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_cart_totals() {
|
function woocommerce_cart_totals() {
|
||||||
woocommerce_get_template( 'cart/cart-totals.php' );
|
wc_get_template( 'cart/cart-totals.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ function woocommerce_cart_totals_shipping_html() {
|
||||||
foreach ( $packages as $i => $package ) {
|
foreach ( $packages as $i => $package ) {
|
||||||
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
|
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
|
||||||
|
|
||||||
woocommerce_get_template( 'cart/cart-shipping.php', array( 'package' => $package, 'available_methods' => $package['rates'], 'show_package_details' => ( sizeof( $packages ) > 1 ), 'index' => $i, 'chosen_method' => $chosen_method ) );
|
wc_get_template( 'cart/cart-shipping.php', array( 'package' => $package, 'available_methods' => $package['rates'], 'show_package_details' => ( sizeof( $packages ) > 1 ), 'index' => $i, 'chosen_method' => $chosen_method ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,7 +1160,7 @@ function woocommerce_cart_totals_coupon_html( $coupon ) {
|
||||||
$value = array();
|
$value = array();
|
||||||
|
|
||||||
if ( ! empty( WC()->cart->coupon_discount_amounts[ $coupon->code ] ) )
|
if ( ! empty( WC()->cart->coupon_discount_amounts[ $coupon->code ] ) )
|
||||||
$value[] = '-' . woocommerce_price( WC()->cart->coupon_discount_amounts[ $coupon->code ] );
|
$value[] = '-' . wc_price( WC()->cart->coupon_discount_amounts[ $coupon->code ] );
|
||||||
|
|
||||||
if ( $coupon->enable_free_shipping() )
|
if ( $coupon->enable_free_shipping() )
|
||||||
$value[] = __( 'Free shipping coupon', 'woocommerce' );
|
$value[] = __( 'Free shipping coupon', 'woocommerce' );
|
||||||
|
@ -1182,7 +1182,7 @@ function woocommerce_cart_totals_order_total_html() {
|
||||||
foreach ( WC()->cart->get_tax_totals() as $code => $tax )
|
foreach ( WC()->cart->get_tax_totals() as $code => $tax )
|
||||||
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
||||||
} else {
|
} else {
|
||||||
$tax_string_array[] = sprintf( '%s %s', woocommerce_price( WC()->cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() );
|
$tax_string_array[] = sprintf( '%s %s', wc_price( WC()->cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $tax_string_array ) )
|
if ( ! empty( $tax_string_array ) )
|
||||||
|
@ -1195,7 +1195,7 @@ function woocommerce_cart_totals_order_total_html() {
|
||||||
* @param object $fee
|
* @param object $fee
|
||||||
*/
|
*/
|
||||||
function woocommerce_cart_totals_fee_html( $fee ) {
|
function woocommerce_cart_totals_fee_html( $fee ) {
|
||||||
echo WC()->cart->tax_display_cart == 'excl' ? woocommerce_price( $fee->amount ) : woocommerce_price( $fee->amount + $fee->tax );
|
echo WC()->cart->tax_display_cart == 'excl' ? wc_price( $fee->amount ) : wc_price( $fee->amount + $fee->tax );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1208,12 +1208,12 @@ function woocommerce_cart_totals_shipping_method_label( $method ) {
|
||||||
|
|
||||||
if ( $method->cost > 0 ) {
|
if ( $method->cost > 0 ) {
|
||||||
if ( WC()->cart->tax_display_cart == 'excl' ) {
|
if ( WC()->cart->tax_display_cart == 'excl' ) {
|
||||||
$label .= ': ' . woocommerce_price( $method->cost );
|
$label .= ': ' . wc_price( $method->cost );
|
||||||
if ( $method->get_shipping_tax() > 0 && WC()->cart->prices_include_tax ) {
|
if ( $method->get_shipping_tax() > 0 && WC()->cart->prices_include_tax ) {
|
||||||
$label .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
$label .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$label .= ': ' . woocommerce_price( $method->cost + $method->get_shipping_tax() );
|
$label .= ': ' . wc_price( $method->cost + $method->get_shipping_tax() );
|
||||||
if ( $method->get_shipping_tax() > 0 && ! WC()->cart->prices_include_tax ) {
|
if ( $method->get_shipping_tax() > 0 && ! WC()->cart->prices_include_tax ) {
|
||||||
$label .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
$label .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
||||||
}
|
}
|
||||||
|
@ -1235,7 +1235,7 @@ if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) {
|
||||||
* @param string $orderby
|
* @param string $orderby
|
||||||
*/
|
*/
|
||||||
function woocommerce_cross_sell_display( $posts_per_page = 2, $columns = 2, $orderby = 'rand' ) {
|
function woocommerce_cross_sell_display( $posts_per_page = 2, $columns = 2, $orderby = 'rand' ) {
|
||||||
woocommerce_get_template( 'cart/cross-sells.php', array(
|
wc_get_template( 'cart/cross-sells.php', array(
|
||||||
'posts_per_page' => $posts_per_page,
|
'posts_per_page' => $posts_per_page,
|
||||||
'orderby' => $orderby,
|
'orderby' => $orderby,
|
||||||
'columns' => $columns
|
'columns' => $columns
|
||||||
|
@ -1261,7 +1261,7 @@ if ( ! function_exists( 'woocommerce_mini_cart' ) ) {
|
||||||
|
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
woocommerce_get_template( 'cart/mini-cart.php', $args );
|
wc_get_template( 'cart/mini-cart.php', $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1286,7 +1286,7 @@ if ( ! function_exists( 'woocommerce_login_form' ) ) {
|
||||||
|
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
woocommerce_get_template( 'shop/form-login.php', $args );
|
wc_get_template( 'shop/form-login.php', $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,7 +1300,7 @@ if ( ! function_exists( 'woocommerce_checkout_login_form' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_checkout_login_form() {
|
function woocommerce_checkout_login_form() {
|
||||||
woocommerce_get_template( 'checkout/form-login.php', array( 'checkout' => WC()->checkout() ) );
|
wc_get_template( 'checkout/form-login.php', array( 'checkout' => WC()->checkout() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1325,7 +1325,7 @@ if ( ! function_exists( 'woocommerce_breadcrumb' ) ) {
|
||||||
|
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
woocommerce_get_template( 'shop/breadcrumb.php', $args );
|
wc_get_template( 'shop/breadcrumb.php', $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,7 +1339,7 @@ if ( ! function_exists( 'woocommerce_order_review' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_order_review() {
|
function woocommerce_order_review() {
|
||||||
woocommerce_get_template( 'checkout/review-order.php', array( 'checkout' => WC()->checkout() ) );
|
wc_get_template( 'checkout/review-order.php', array( 'checkout' => WC()->checkout() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1353,7 +1353,7 @@ if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_checkout_coupon_form() {
|
function woocommerce_checkout_coupon_form() {
|
||||||
woocommerce_get_template( 'checkout/form-coupon.php', array( 'checkout' => WC()->checkout() ) );
|
wc_get_template( 'checkout/form-coupon.php', array( 'checkout' => WC()->checkout() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1491,7 +1491,7 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
|
||||||
echo $before;
|
echo $before;
|
||||||
}
|
}
|
||||||
|
|
||||||
woocommerce_get_template( 'content-product_cat.php', array(
|
wc_get_template( 'content-product_cat.php', array(
|
||||||
'category' => $category
|
'category' => $category
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -1569,7 +1569,7 @@ if ( ! function_exists( 'woocommerce_order_details_table' ) ) {
|
||||||
function woocommerce_order_details_table( $order_id ) {
|
function woocommerce_order_details_table( $order_id ) {
|
||||||
if ( ! $order_id ) return;
|
if ( ! $order_id ) return;
|
||||||
|
|
||||||
woocommerce_get_template( 'order/order-details.php', array(
|
wc_get_template( 'order/order-details.php', array(
|
||||||
'order_id' => $order_id
|
'order_id' => $order_id
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
@ -1702,7 +1702,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
|
||||||
$country_key = $key == 'billing_state'? 'billing_country' : 'shipping_country';
|
$country_key = $key == 'billing_state'? 'billing_country' : 'shipping_country';
|
||||||
|
|
||||||
if ( isset( $_POST[ $country_key ] ) ) {
|
if ( isset( $_POST[ $country_key ] ) ) {
|
||||||
$current_cc = woocommerce_clean( $_POST[ $country_key ] );
|
$current_cc = wc_clean( $_POST[ $country_key ] );
|
||||||
} elseif ( is_user_logged_in() ) {
|
} elseif ( is_user_logged_in() ) {
|
||||||
$current_cc = get_user_meta( get_current_user_id() , $country_key, true );
|
$current_cc = get_user_meta( get_current_user_id() , $country_key, true );
|
||||||
if ( ! $current_cc) {
|
if ( ! $current_cc) {
|
||||||
|
|
|
@ -88,12 +88,12 @@ class WC_Widget_Layered_Nav_Filters extends WC_Widget {
|
||||||
|
|
||||||
if ( $min_price ) {
|
if ( $min_price ) {
|
||||||
$link = remove_query_arg( 'min_price' );
|
$link = remove_query_arg( 'min_price' );
|
||||||
echo '<li class="chosen"><a title="' . __( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . __( 'Min', 'woocommerce' ) . ' ' . woocommerce_price( $min_price ) . '</a></li>';
|
echo '<li class="chosen"><a title="' . __( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . __( 'Min', 'woocommerce' ) . ' ' . wc_price( $min_price ) . '</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $max_price ) {
|
if ( $max_price ) {
|
||||||
$link = remove_query_arg( 'max_price' );
|
$link = remove_query_arg( 'max_price' );
|
||||||
echo '<li class="chosen"><a title="' . __( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . __( 'Max', 'woocommerce' ) . ' ' . woocommerce_price( $max_price ) . '</a></li>';
|
echo '<li class="chosen"><a title="' . __( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . __( 'Max', 'woocommerce' ) . ' ' . wc_price( $max_price ) . '</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</ul>";
|
echo "</ul>";
|
||||||
|
|
|
@ -293,7 +293,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
|
||||||
// Base Link decided by current page
|
// Base Link decided by current page
|
||||||
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
|
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
|
||||||
$link = home_url();
|
$link = home_url();
|
||||||
} elseif ( is_post_type_archive( 'product' ) || is_page( woocommerce_get_page_id('shop') ) ) {
|
} elseif ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id('shop') ) ) {
|
||||||
$link = get_post_type_archive_link( 'product' );
|
$link = get_post_type_archive_link( 'product' );
|
||||||
} else {
|
} else {
|
||||||
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
||||||
|
|
|
@ -173,7 +173,7 @@ class WC_Widget_Products extends WC_Widget {
|
||||||
|
|
||||||
while ( $r->have_posts()) {
|
while ( $r->have_posts()) {
|
||||||
$r->the_post();
|
$r->the_post();
|
||||||
woocommerce_get_template( 'content-widget-product.php', array( 'show_rating' => $show_rating ) );
|
wc_get_template( 'content-widget-product.php', array( 'show_rating' => $show_rating ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|
|
@ -81,7 +81,7 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
|
||||||
|
|
||||||
while ( $r->have_posts()) {
|
while ( $r->have_posts()) {
|
||||||
$r->the_post();
|
$r->the_post();
|
||||||
woocommerce_get_template( 'content-widget-product.php' );
|
wc_get_template( 'content-widget-product.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue