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

Problems with product variations #92

Open
haugli92 opened this issue Feb 4, 2021 · 2 comments
Open

Problems with product variations #92

haugli92 opened this issue Feb 4, 2021 · 2 comments

Comments

@haugli92
Copy link

haugli92 commented Feb 4, 2021

When using Monero as payment on product variations it does not get completed.
I have looked in the source code and it does not take into account that variations have a different product-id.

This function will just look for the main product-id and not the variation-id.

protected static function is_virtual_in_cart($order_id)
{
$order = wc_get_order($order_id);
$items = $order->get_items();
$cart_size = count($items);
$virtual_items = 0;
foreach ( $items as $item ) {
$product = new WC_Product( $item['product_id'] );
if ($product->is_virtual()) {
$virtual_items += 1;
}
}
return $virtual_items == $cart_size;
}

@haugli92
Copy link
Author

haugli92 commented Feb 4, 2021

Quickfix for me cause im just using 1 product
if ($product->is_virtual() || $item['product_id'] == 1) { $virtual_items += 1; }

@serhack
Copy link
Member

serhack commented Feb 8, 2021

Hm, interesting. Thanks for having filled an issue, I hope to investigate on it soon.

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

2 participants