Skip to content
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

Set the price of a variable product to the minimum price of its variations on Product Feed #2790

Open
nima-karimi opened this issue Aug 19, 2024 · 0 comments

Comments

@nima-karimi
Copy link
Contributor

The price of the parent variable product must be set to the minimum price of its variations/children. This is how the tracking event is set up, so we should change the feed to be consistent with that:

if ( WC_Facebookcommerce_Utils::is_variable_type( $product->get_type() ) ) {
$product_price = $product->get_variation_price( 'min' );
} else {
$product_price = $product->get_price();
}

We also apply the same idea to other similar product types:

} elseif ( $product->is_type( 'composite' ) ) {
$price = $product->get_composite_price( 'min', true );
} elseif ( $product->is_type( 'bundle' ) ) {
// If product is a product bundle with individually priced items, we rely on their pricing.
$price = $product->get_bundle_price( 'min', true );
} elseif ( $product->is_type( 'mix-and-match' ) && is_callable( array( $product, 'get_container_price' ) ) ) {
// If product is Mix and Match product with individually priced items, we rely on their pricing, since MNM 2.0.
$price = $product->get_container_price( 'min', true );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant