jayhaluska
Forum Replies Created
-
No, our variable base product does not have a price. In fact, variable parent products can’t even have a price as there is no price input field for base variable products. Only its variations have a price input field in WooCommerce.
The rationale behind this IF-statement is that a product needs to have a price otherwise it also doesn’t make sense to advertise on it.
You say variable products have no price on their base product. That is exactly what the problem is.The if-condition in line 608 is checking this and it fails for variable products as there is no price. Why the code is working in your development environment I really can not say. Maybe we are running different versions of WooCommerce – ours is 5.0.0.
I get the rationale but the price should be checked later when it is known whether the product is variable or not.
I commented out this if-statement – now the variable products show the ecomm params properly, see: https://ultimus.ch/product/akustik-schaumstoff-platten-300mm-x-300mm-x-2-5mm/
I am pretty sure that this problem is not only affecting us. I recommend you to try to reproduce this behaviour.
- This reply was modified 4 years ago by jayhaluska.
- This reply was modified 4 years ago by jayhaluska. Reason: Typo
I understand that the plugin uses the lowest price for variable products, if no specific variable product is passed. But this happens ONLY if the if-conditional in line 608 of woocommerce-sea.php is passed.
In our websites this is not the case, because $product->get_price() is the empty string on our variable products, there is no price to retrieve from the base product. However, later the lowest variation price is successfully retrieved with $product->get_variation_prices() – and that is why it works when this if-conditional is removed.
In your development environment it could be possible that the $product->get_price() (which is the base product of the variable products) has a price (I don’t know why but this could be) and that is why it is working for you.
In any case, I do not get why the if-conditional in line 608/679 even exists – what is the rationale for that?
This line is breaking the plugin functionality for our variable product sites. Non-variable products are working fine. See: https://ultimus.ch/product/antistatischer-haarfaerbe-kamm-schwarz/
I could reproduce the error of ultimus in my local development environment.
It is related to the woocommerce-sea.php:
Line 608: if ( ” !== $product->get_price()) {
Line 679: }If I comment out these lines, the google_tag_params with its values ecomm_prodid, ecomme_pagetype and ecomm_totalvalue are added to the footer script properly.
The problem is that $product->get_price() function returns an empty string for variable products which causes the google_tag_params data to not be added to the footer script.
I am not sure what the reason for this if-conditional is, in any case, it is breaking the plugin functionality for people with no prices on their base products and should be fixed by the developers in my opinion.