-
Notifications
You must be signed in to change notification settings - Fork 69
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
Fix formatting product when variation has no attributes #372
Conversation
@@ -230,7 +230,7 @@ public function get_formatted_product( WC_Product $product, $variation = false ) | |||
$variation = $product->get_attributes(); | |||
} | |||
|
|||
if ( false !== $variation ) { | |||
if ( false !== $variation && is_array( $variation ) ) { |
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.
I think just having if ( is_array( $variation ) )
would be sufficient, so we can remove the false !== $variation
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.
I removed the variation
function param completely.
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.
Brought back the $variation
, so we'd use it for non-"variation" producs
e1428eb
to
ec9848a
Compare
add a bit more elaborate code comment.
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.
Thanks! LGTM!
Changes proposed in this Pull Request:
quick-fix formatting product when variation has no attributes
Address #371
I was not able to reproduce it using UI, but according to #371 there is a chance to get
woocommerce_add_to_cart
fired for a product with$variation
other thanfalse
but with no attributes.Checks:
Screenshots:
Detailed test instructions:
$variation = []
towoocommerce-google-analytics-integration/includes/class-wc-abstract-google-analytics-js.php
Line 232 in 7594c1b
Additional details:
Changelog entry