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

Update Product.php #191

Merged
merged 6 commits into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions includes/Handlers/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1657,13 +1657,12 @@ private static function update_price_money( $product, \Square\Models\CatalogObje
*/
public static function get_parent_product_id_by_variation_id( $variation_id ) {
global $wpdb;

return $wpdb->get_var(
$wpdb->prepare(
"
SELECT pr.post_parent
FROM wp_posts pr
INNER JOIN wp_posts pp ON pp.ID = pr.post_parent
FROM {$wpdb->prefix}posts pr
INNER JOIN {$wpdb->prefix}posts pp ON pp.ID = pr.post_parent
WHERE pr.ID=%d AND pr.post_type IN ('product', 'product_variation') AND pp.post_type = 'product';
",
$variation_id
Expand Down
Loading