Woocommerce taxes not working after update - php

I have a big problem with my Woocommerce shop. After upgrading to version 3.6.4 (latest) and WP 5.2.1 suddenly my Woocommerce admin.php page stops loading. Additionally, it seems that taxes are not added to my products and therefore not added in the checkout.
In other words, when opening the taxes page, half the page is loaded but the table with tax info always says "loading".
Looking at the console I see these errors:
TypeError: a.ui is undefined draggable.min.js:11:133
TypeError: a.ui is undefined slider.min.js:11:126
TypeError: a.widget is not a function iris.min.js:4:16724
TypeError: a.widget is not a function menu.min.js:11:138
TypeError: a.widget is not a function autocomplete.min.js:11:147
TypeError: s(...).iris is not a function settings.min.js:1:806
After Googling I found some possible solutions like enqueuing scripts in theme-functions.php. However it works for some scripts (error goes away) but not for settings.min.js for example.
function test_load_scripts($hook) {
wp_enqueue_script('jquery-ui-draggable');
wp_enqueue_script('jquery-ui-menu');
wp_enqueue_script('jquery-ui-autocomplete');
wp_enqueue_script('iris');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('settings', 'wp-content/plugins/woocommerce/assets/js/admin/settings.min.js' );
}
add_action('admin_enqueue_scripts', 'test_load_scripts');
Further I tried to enable/disable plugins. However I think it's coming from the Woocommerce plugin itself since the errors are only visible on the admin pages for Woocommerce.
Does anybody know what cause this? And better how to fix it? I'm pretty new to WP and Woo so I hope someone can help.

Related

Elementor Function is not working properly in Document.php

I am working on a site that suddenly has these error messages:
[25-Aug-2022 16:23:38 UTC] PHP Notice: Undefined variable: post in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:38 UTC] PHP Notice: Undefined property: Elementor\Core\Kits\Documents\Kit::$ in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:38 UTC] PHP Notice: Trying to access array offset on value of type null in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:50 UTC] PHP Notice: Trying to get property 'ID' of non-object in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
The errors showed up whenever a customer tried to put a variable product into the shopping cart. On the front end it says:
This doesn't happen if the customer adds a non-variable product to the cart, so I am not sure what is happening or how to repair this. I have reached out to elementor with no response at this point after 24 hours.
The code referenced in the error log is:
public function get_main_id() {
if ( ! $this->main_id ) {
$post_id = $this->post->ID;
$parent_post_id = wp_is_post_revision( $post_id );
if ( $parent_post_id ) {
$post_id = $parent_post_id;
}
$this->main_id = $post_id;
}
return $this->main_id;
}
This occurred after the site was moved to a new hosting company, however, the site was working fine for the past three weeks, and the issue wasn't present.
I was able to figure out (With the help of Elementor Tier 2 support) that the hosting provider (Site Grounds) installs a plugin called "SiteGround Optimizer" that was causing this issue. There is a conflict between this plugin and Elementor in case anyone is having this issue.
EDITED: SiteGround was able to turn off the "Defer Render-blocking JavaScript" feature and the plugin worked with the rest of the site. If you are having a strange issue and you are on SiteGround, I highly recommend you turn this feature off to troubleshoot the issue better.
This is occurring on Kinsta too - so it's not just the SG plugin. It could still be optimization related - but I can't seem to find a resolution yet (even rolling back versions isn't helping me).
that issue comes in new version of elementor, just rollback it previous version following this video https://youtu.be/3uwCRcQvIFw

Wordpress Customize not working - load-scripts.php errors

When I try to customize my Wordpress theme, I get a blank screen. I disabled plugins and the error was still there - it's the theme, I tried a different theme and the issue was gone.
I ran the JS console and got these errors, but I don't know what they mean:
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:58 Uncaught TypeError: Cannot read property 'replace' of undefined
at Function.m.template (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:58)
at n.template (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:61)
at n.render (load-scripts.php?c=1&load[]=jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,heartbeat,customize-base,customize-controls,customize-widgets,thickbox,&load[]=mce-view,imgareaselect,image-edit,quicktags,wplink,jquery-ui-position,jquery-ui-menu,jquery-ui-autocomplete,media-upload,accordi&load[]=on,customize-nav-menus,customize-models,customize-views,updates&ver=4.9.8:722)
at n.initialize (load-scripts.php?c=1&load[]=jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,heartbeat,customize-base,customize-controls,customize-widgets,thickbox,&load[]=mce-view,imgareaselect,image-edit,quicktags,wplink,jquery-ui-position,jquery-ui-menu,jquery-ui-autocomplete,media-upload,accordi&load[]=on,customize-nav-menus,customize-models,customize-views,updates&ver=4.9.8:718)
at n.e.View (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:84)
at n.constructor (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:86)
at new n (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:84)
at f.ready (load-scripts.php?c=1&load[]=jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,heartbeat,customize-base,customize-controls,customize-widgets,thickbox,&load[]=mce-view,imgareaselect,image-edit,quicktags,wplink,jquery-ui-position,jquery-ui-menu,jquery-ui-autocomplete,media-upload,accordi&load[]=on,customize-nav-menus,customize-models,customize-views,updates&ver=4.9.8:31)
at Object.<anonymous> (load-scripts.php?c=1&load[]=jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,heartbeat,customize-base,customize-controls,customize-widgets,thickbox,&load[]=mce-view,imgareaselect,image-edit,quicktags,wplink,jquery-ui-position,jquery-ui-menu,jquery-ui-autocomplete,media-upload,accordi&load[]=on,customize-nav-menus,customize-models,customize-views,updates&ver=4.9.8:31)
at i (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,underscore,wp-a11y,wp-util,jquery&load[]=-ui-sortable,jquery-ui-droppable,backbone,wp-backbone,jquery-ui-tabs,shortcode,utils,media-models,moxiejs,plupload,wp-plupload&ver=4.9.8:2)
It seems like you are not the first one to have this problem. I cannot debug your problem for you (as load-scripts.php is a core file which is obvioiusly loading a lot) but MAYBE your problem is the same as described here: https://iansvoboda.com/code/dealing-load-scripts-php-console-errors-wordpress/
Ultimately the issue came down to extra white-space in the top of a functions.php include.
If your WordPress theme’s functions.php file (or any files
included/required inside of it) has extra white-space before the first
opening PHP tag, WordPress may not function correctly. The exact
issue(s) caused by the white-space vary depending on your setup and in
this case they took the form of a console error.
Therefore: Go ahead - check your theme files.

Error: Call to undefined function get_meta() in functions.php

I have inherited a custom wordpress theme and am doing a few changes to it (all cosmetics of changing city names, etc) , but at the bottom of a post I get the error : "Fatal error: Call to undefined function get_meta()"
In my functions.php I have this:
function bardetails(){
$web = get_meta('web');
$email = get_meta('email');
//...
}
I have a Java background but am new to php and wordpress. I dont see anywhere else this function is called, but must be tied to a post.
Have looked and can find a lot of problems about "get_post_meta()" and "meta()" but nothing about this. It also seems to be working on the other site the theme is on. I used FTP to pull over everything and all the other parts of the site seem to work fine. Looked at the database for something that could help with no luck, and also have tried to find if this is some kind of library, as the intention of the function is clear and thats to grab the website/email of the post.
So is this just a straight custom function? And if so were should it be defined in a php/wordpress setup?
It was due to a plugin that was not installed. "More Fields" By Henrik Melin, Kal Ström is a seemingly defunct plugin that was needed that allows you to use "get_meta()". For now, I just copied over the plugin but seems like I need to find an alternative going forward.

Magento Call to a member function getGrandTotal() on a non-object

i have a mutisotre setup magento and each store has its own domain . since i upgrade to magento 1.4 i am getting error in my cart page ,suppose if you add a item to cart and try to check out ,you will see unit price and subtotal is not pulling up and i am gettign following error . i dont have any idea why is this hapning .Any help would be appreciated.
web link : dev.comitstore.com
error you will see when you reach : http://dev.comitstores.com/checkout/cart/
Note : At backend everything is set appropriately like price, inventory, Tax .
Error :
Fatal error: Call to a member function getGrandTotal() on a non-object in /var/www/vhosts/comitstores.com/subdomains/dev/httpdocs/app/code/core/Mage/Tax/Block/Checkout/Grandtotal.php
I think you should install xdebug so that you could have a stack trace instead of only one helpless line. This would certainly give you the name of a template you need to rewrite accordingly to 1.4 .

Magento Fatal Error: Call to member function getSku() on a non-object

I have come across a bizarre error in the Magento shop I'm developing and despite my inquiries online, it appears no one else has ever seen this exact error under the same circumstances. Lemme 'splain.
The full text of the error message is this:
Fatal error: Call to a member function getSku() on a non-object in /path/on/server/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php on line 221.
Now, others have gotten this error message--it was addressed and supposedly fixed in the 1.3.1 roadmap (http://www.magentocommerce.com/roadmap/release/1.3.1). However, the circumstances of those other error messages were where they tried to add an item to the cart--if the item had custom options, it would loop to this error message.
My situation is that I have a SIMPLE item--not bundled or configurable--without any custom options. I can add it to the cart without any trouble. But if I run through the entire checkout procedure, upon placing the order, the error message appears on a white screen. The URL in the browser shows me I’m on the checkout success page.
AND, the order appears to go through perfectly, getting registered by both Magento AND Authorize.net.
I’ve tried debugging the error as far as I can go, but this one’s got me stumped.
For reference, I’m in Magento 1.3.2.4. When I first received the error I reinstalled all the core files and was still able to replicate the error.
I’m going to continue to test, but if anyone has ANY bright ideas about why this is happening, I’d love to hear your thoughts. I’m so close to launch and this thing could put the kibosh on the whole thing.
I've had this error before and was also not getting any hits on how to solve it. So, I had to modify the core files to fix the error message. The problem is Mage_Catalog_Model_Product_Option::getValueById() can return a null value BUT Catalog/Model/Product/Option/Type/Select.php is NOT checking for this possibility.
Here's the solution that worked for me:
Open app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php
Change line 121 from:
$result = $option->getValueById($optionValue)->getSku();
To:
$o= $option->getValueById($optionValue);
$result = is_object($o) ? $o->getSku() : null;
I always hate changing core files but when there's a bug there's not much else I can do!
I followed that steps that pygorex1 posted but also replaced lines 191-195 in the Select.php file, because I was still getting another similar error about the getPrice(). I have Magento ver. 1.3.2.4.
Original code from lines 191-195:
$result = $this->_getChargableOptionPrice(
$option->getValueById($optionValue)->getPrice(),
$option->getValueById($optionValue)->getPriceType() == 'percent',
$basePrice
);
Here is the code I created to replace lines 191-195:
$z= $option->getValueById($optionValue);
$result = is_object($z) ? $z ->getPrice() : null;
$zz = $option->getValueById($optionValue);
$result = is_object($zz) ? $zz ->getPriceType() == 'percent' : $basePrice;
FYI - I am NOT a PHP programmer. I just happened to figure out how to rework the code to make fix this problem based on pygorex1's code. So, there is a good chance I didn't write it correctly. However, it did fix the problem for me (which I am rather proud of :)
Got same problem. Backtraced it and identified it happens for me when editing orders in admin and that order contains at least one product with an individual option that was removed since the order has been placed.
Fixed three files then so that product is simply removed when editing such an order - all modifications working in "local" scope so core files left untouched:
1. app/code/local/Mage/Catalog/Model/Product/Option/Type/Select.php:221
(search)
$result = $option->getValueById($optionValue)->getSku();
(prepend)
/* hotfix for - PHP Fatal error: Call to a member function getSku() on a non-object - occurs on admin order edit if a product option has been removed */
if (is_null($option->getValueById($optionValue))) {
throw new Exception('missing product option');
}
2. app/code/local/Mage/Sales/Model/Quote.php:695
(search)
$item = $this->_addCatalogProduct($candidate, $candidate->getCartQty());
(replace)
/* hotfix for - PHP Fatal error: Call to a member function getSku() on a non-object - occurs on admin order edit if a product option has been removed */
try {
$item = $this->_addCatalogProduct($candidate, $candidate->getCartQty());
} catch ( Exception $e ) {
if ($e->getMessage()=='missing product option') { return null; }
throw new Exception($e->getMessage());
}
3. app/code/local/Mage/Adminhtml/Model/Sales/Order/Create.php:288
(search)
if (is_string($item)) {
return $item;
}
(replace)
if (is_string($item)) {
return $item;
/* hotfix for - PHP Fatal error: Call to a member function getSku() on a non-object - occurs on admin order edit if a product option has been removed */
} elseif (is_null($item)) {
return $this;
}
Well, I had the same error for my client, Magento was working fine on one server but not on the other so I though it must be something wrong with new installation (after migration). I did not play with the code, just repaired the DB and it started to work properly.

Categories