Goodmorning,
i had created a php script that retreive the lists of all coupons.
After the last Wordpress update 6.0 this doesnt works anymore.
$coupons = json_encode($woocommerce->get('coupons', array('per_page' => 50)));
this is the error i receive now
Fatal error: Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: Error: <p>Si è verificato un errore critico sul tuo sito web.</p><p>Scopri di più riguardo la risoluzione dei problemi in WordPress.</p> [internal_server_error] in C:\xampp\htdocs\coupon\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php:350 Stack trace: #0 C:\xampp\htdocs\coupon\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php(386): Automattic\WooCommerce\HttpClient\HttpClient->lookForErrors(Object(stdClass)) #1 C:\xampp\htdocs\coupon\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php(422): Automattic\WooCommerce\HttpClient\HttpClient->processResponse() #2 C:\xampp\htdocs\coupon\vendor\automattic\woocommerce\src\WooCommerce\Client.php(82): Automattic\WooCommerce\HttpClient\HttpClient->request('coupons', 'GET', Array, Array) #3 C:\xampp\htdocs\coupon\index.php(18): Automattic\WooCommerce\Client->get('coupons', Array) #4 {main} thrown in C:\xampp\htdocs\coupon\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php on line 350
At the moment i have the same script to retreive the list of all orders and it works without any problems.
Can someone help me to understand what is happening?
Thank you
Related
My site is broken and below is the displayed message.
When I deactivate Woocommerce, erveything runs well, but I need it activated.
Fatal error: Uncaught Error: Call to a member function is_on_sale() on null in /home/brga7543/smatchcard.com/wp-content/plugins/woocommerce/templates/single-product/sale-flash.php:25 Stack trace: #0 /home/brga7543/smatchcard.com/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include() #1 /home/brga7543/smatchcard.com/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1676): wc_get_template('single-product/...') #2 /home/brga7543/smatchcard.com/wp-includes/class-wp-hook.php(307): woocommerce_show_product_sale_flash('') #3 /home/brga7543/smatchcard.com/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home/brga7543/smatchcard.com/wp-includes/plugin.php(476): WP_Hook->do_action(Array) #5 /home/brga7543/smatchcard.com/wp-content/plugins/woocommerce/templates/content-single-product.php(43): do_action('woocommerce_bef...') #6 /home/brga7543/smatchcard.com/wp-includes/template.php(772): require('/home/brga7543/...') #7 /home/brga7543/smatchcard.com/wp-content/plugins/wo in /home/brga7543/smatchcard.com/wp-content/plugins/woocommerce/templates/single-product/sale-flash.php on line 25
Fatal error: Uncaught Error: [] operator not supported for strings in /homepages/46/d688139689/htdocs/dhruva/wp-content/plugins/revslider/inc_php/framework/base_admin.class.php:72 Stack trace: #0 /homepages/46/d688139689/htdocs/dhruva/wp-content/plugins/revslider/revslider_admin.php(157): UniteBaseAdminClassRev::addMetaBox('Revolution Slid...', Object(UniteSettingsAdvancedRev), Array, NULL) #1 /homepages/46/d688139689/htdocs/dhruva/wp-content/plugins/revslider/revslider_admin.php(68): RevSliderAdmin->addSliderMetaBox() #2 /homepages/46/d688139689/htdocs/dhruva/wp-content/plugins/revslider/revslider_admin.php(40): RevSliderAdmin->init() #3 /homepages/46/d688139689/htdocs/dhruva/wp-content/plugins/revslider/revslider.php(146): RevSliderAdmin->__construct('/homepages/46/d...') #4 /homepages/46/d688139689/htdocs/dhruva/wp-settings.php(215): include_once('/homepages/46/d...') #5 /homepages/46/d688139689/htdocs/dhruva/wp-config.php(89): require_once('/homepages/46/d...') #6 /homepages/46/d688139689/htdocs/dhruva/wp-load.php(37) in /homepages/46/d688139689/htdocs/dhruva/wp-content/plugins/revslider/inc_php/framework/base_admin.class.php on line 72
I renamed revslider folder name from FTP. Still it's not working.
I have tried to edit wc-template-functions.php in my store and did something wrong.
Now I am getting Fatal Error on 281 line.
Fatal error: Uncaught Error: Class 'Constants' not found in /home/kidsandm/oliverthedog/wp-content/plugins/woocommerce/includes/wc-template-functions.php:282 Stack trace: #0 /home/kidsandm/oliverthedog/wp-includes/class-wp-hook.php(292): wc_generator_tag('<meta name="gen...', 'xhtml') #1 /home/kidsandm/oliverthedog/wp-includes/plugin.php(212): WP_Hook->apply_filters('<meta name="gen...', Array) #2 /home/kidsandm/oliverthedog/wp-includes/general-template.php(4728): apply_filters('get_the_generat...', '<meta name="gen...', 'xhtml') #3 /home/kidsandm/oliverthedog/wp-includes/general-template.php(4650): get_the_generator('xhtml') #4 /home/kidsandm/oliverthedog/wp-includes/general-template.php(4627): the_generator('xhtml') #5 /home/kidsandm/oliverthedog/wp-includes/class-wp-hook.php(292): wp_generator('') #6 /home/kidsandm/oliverthedog/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array) #7 /home/kidsandm/oliverthedog/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #8 /home/kidsandm/oliverthedog/wp-includes/gen in /home/kidsandm/oliverthedog/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282
Before that I also had warning at the top that said:
Warning: The use statement with non-compound name 'AutomatticJetpackConstants' has no effect in /home/kidsandm/hondamarine/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 11
but I have hide that line thinking it might help.
What I have change in file?
Additional information.
I was thinking it will change the name of it on front-end as well.
// Additional information tab - shows attributes.
if ( $product && ( $product->has_attributes() || apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) {
$tabs['additional_information'] = array(
'title' => __( 'Additional information', 'woocommerce' ),
'priority' => 20,
'callback' => 'woocommerce_product_additional_information_tab',
);
}
Line 1798.
I have tried to find a code only to replace it, and I found one but did not help.
Now, that code might not be original because I could not find it on GitHub.
Thanks a lot!
It just happened to me too, I tried to edit the code for the same reason, I searched a lot about this problem and I solved it when I downloaded the plugin in zip form and manually upload it and install it, now its working fine for me and all data still in place (categories, products, etc.)!
I had the following 2 errors:
Fatal Error: Uncaught error: Class 'Constants' not found in /Users/anastasiades/Local Sites/pisinaspa/app/public/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282
Error: Class 'Constants' not found in /Users/anastasiades/Local Sites/pisinaspa/app/public/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282
Steps:
1. Backup data in woocommerce
2. Download plugin here
3. On WordPress go to Plugins >> Add new >> Upload plugin
4. Choose Reinstall >> Install now
5. "Replace current with uploaded"
I recommend a good backup of the products and other data before doing this.
Peace!
I'm using WP CLI to manage the cron tasks of my Wordpress installation. Was working well, but now I'm getting the error:
Warning: Some code is trying to do a URL redirect. Backtrace:
#0 WP_CLI\Utils\wp_redirect_handler(https://example.com.br) called at [/home/user/public_html/wp-includes/class-wp-hook.php:289]
#1 WP_Hook->apply_filters(https://example.com.br, Array ([0] => https://example.com.br,[1] => 301)) called at [/home/user/public_html/wp-includes/plugin.php:206]
#2 apply_filters(wp_redirect, https://example.com.br, 301) called at [/home/user/public_html/wp-includes/pluggable.php:1257]
#3 wp_redirect(https://example.com.br, 301) called at [/home/user/public_html/wp-content/plugins/w3-total-cache/PgCache_Plugin.php:214]
#4 W3TC\PgCache_Plugin->redirect_on_foreign_domain() called at [/home/user/public_html/wp-includes/class-wp-hook.php:287]
#5 WP_Hook->apply_filters(, Array ([0] => )) called at [/home/user/public_html/wp-includes/class-wp-hook.php:311]
#6 WP_Hook->do_action(Array ([0] => )) called at [/home/user/public_html/wp-includes/plugin.php:478]
#7 do_action(init) called at [/home/user/public_html/wp-settings.php:546]
#8 require(/home/user/public_html/wp-settings.php) called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1237]
#9 WP_CLI\Runner->load_wordpress() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1158]
#10 WP_CLI\Runner->start() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23]
#11 WP_CLI\Bootstrap\LaunchRunner->process(WP_CLI\Bootstrap\BootstrapState Object ([WP_CLI\Bootstrap\BootstrapStatestate] => Array ())) called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:74]
#12 WP_CLI\bootstrap() called at [phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27]
#13 include(phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php) called at [phar:///usr/local/bin/wp/php/boot-phar.php:11]
#14 include(phar:///usr/local/bin/wp/php/boot-phar.php) called at [/usr/local/bin/wp:4]
Any tips?
Googling, I realized that the problem was W3 Total Cache plugin, and used the option:
--skip-plugins=w3-total-cache
I'ts working now:
wp cron event run --due-now --skip-plugins=w3-total-cache
should work with any other plugin showing the same error
I'm triying the Woo Dashboard example from this github bu
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in [[[[MY FILE URL]]]] Stack trace: #0 {main} thrown in [[[[MY FILE URL]]]] on line 33
The code in line 32 and 33 is the following:
$sales = $woocommerce->get('reports/sales', $query);
$sale = $sales[0]["total_sales"];
I've read many people who had use this github as boilerplate but none one else with this issue
I've change $sale = $sales[0]["total_sales"]; to $sale = $sales[0]->total_sales; and is working now.