mirror of
https://github.com/pronamic/woocommerce-subscriptions.git
synced 2025-10-15 22:02:56 +00:00
2.2.7
This commit is contained in:

committed by
Remco Tolsma

parent
5e536ec717
commit
b99eba2f79
@@ -27,11 +27,13 @@ function wcs_get_price_including_tax( $product, $args = array() ) {
|
||||
|
||||
if ( function_exists( 'wc_get_price_including_tax' ) ) { // WC 3.0+
|
||||
$price = wc_get_price_including_tax( $product, $args );
|
||||
$filter = 'woocommerce_product_get_price';
|
||||
} else { // WC < 3.0
|
||||
$price = $product->get_price_including_tax( $args['qty'], $args['price'] );
|
||||
$filter = 'woocommerce_get_price';
|
||||
}
|
||||
|
||||
return $price;
|
||||
return apply_filters( $filter, $price , $product );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,11 +53,13 @@ function wcs_get_price_excluding_tax( $product, $args = array() ) {
|
||||
|
||||
if ( function_exists( 'wc_get_price_excluding_tax' ) ) { // WC 3.0+
|
||||
$price = wc_get_price_excluding_tax( $product, $args );
|
||||
$filter = 'woocommerce_product_get_price';
|
||||
} else { // WC < 3.0
|
||||
$price = $product->get_price_excluding_tax( $args['qty'], $args['price'] );
|
||||
$filter = 'woocommerce_get_price';
|
||||
}
|
||||
|
||||
return $price;
|
||||
return apply_filters( $filter, $price , $product );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,22 +86,12 @@ function wcs_get_price_html_from_text( $product = '' ) {
|
||||
*/
|
||||
function wcs_get_variation_prices( $variation, $variable_product ) {
|
||||
|
||||
if ( WC_Subscriptions::is_woocommerce_pre( '3.0' ) ) {
|
||||
$regular_price = $variation->regular_price;
|
||||
$sale_price = $variation->sale_price;
|
||||
} else {
|
||||
$regular_price = $variation->get_regular_price( 'edit' );
|
||||
$sale_price = $variation->get_sale_price( 'edit' );
|
||||
}
|
||||
|
||||
$prices = array(
|
||||
return array(
|
||||
'price' => apply_filters( 'woocommerce_variation_prices_price', WC_Subscriptions_Product::get_price( $variation ), $variation, $variable_product ),
|
||||
'regular_price' => apply_filters( 'woocommerce_variation_prices_regular_price', WC_Subscriptions_Product::get_regular_price( $variation, 'edit' ), $variation, $variable_product ),
|
||||
'sale_price' => apply_filters( 'woocommerce_variation_prices_sale_price', WC_Subscriptions_Product::get_sale_price( $variation, 'edit' ), $variation, $variable_product ),
|
||||
'sign_up_fee' => apply_filters( 'woocommerce_variation_prices_sign_up_fee', WC_Subscriptions_Product::get_sign_up_fee( $variation ), $variation, $variable_product ),
|
||||
);
|
||||
|
||||
return $prices;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +165,7 @@ function wcs_calculate_min_max_variations( $variations_data ) {
|
||||
|
||||
$is_max = $is_min = false;
|
||||
|
||||
if ( empty( $variation_data['price'] ) && empty( $variation_data['subscription']['sign_up_fee'] ) ) {
|
||||
if ( '' === $variation_data['price'] && '' === $variation_data['subscription']['sign_up_fee'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user