-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Adding an option to exclude products from selected product categories from applying the Call for Price feature. #55
base: master
Are you sure you want to change the base?
Conversation
…gories from applying the Call for Price feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpcs scanning turned up:
hashes-api-scanning skipped
@@ -517,7 +513,12 @@ public function fetch_product_price_if_zero_or_empty( $price, $_product ) { | |||
* @since 3.0.3 | |||
*/ | |||
public function make_empty_price( $price, $_product ) { | |||
return $this->fetch_product_price_if_zero_or_empty( $price, $_product ); | |||
$exclude_products = get_option( 'alg_call_for_price_exclude_product', array() ); | |||
if ( in_array( $_product->id, $exclude_products ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return $price_hash; | ||
} | ||
} | ||
if ( in_array( $_product->id, $exclude_products ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$exclude_products = get_option( 'alg_call_for_price_exclude_product', array() ); | ||
$categories = get_the_terms( $_product->id, 'product_cat' ); | ||
foreach ( $categories as $cat ) { | ||
if ( in_array( $cat->term_id, $exclude_categories ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( ! empty( $product_terms ) ) { | ||
foreach ( $product_terms as $product_term ) { | ||
if ( in_array( (string) $product_term->term_id, $term_ids, true ) ) { | ||
return ''; | ||
if ( in_array( $product_term->term_id, $exclude_categories ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -398,15 +372,25 @@ public function make_empty_price_by_product_price( $price, $_product ) { | |||
* @since 3.2.0 | |||
*/ | |||
public function make_empty_price_per_taxonomy( $price, $_product ) { | |||
|
|||
$exclude_products = get_option( 'alg_call_for_price_exclude_product', array() ); | |||
if ( in_array( $_product->id, $exclude_products ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub API communication error. Please contact a human. (commit-ID: b2a84b3). |
Fix #35.