woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.42k stars 10.77k forks source link

WC 6.5 RC: The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1. #32863

Closed jkohlbach closed 2 years ago

jkohlbach commented 2 years ago

Prerequisites

Describe the bug

Looks like core is producing a deprecation notice in WC 6.5 RC.

The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.

I traced this to user_has_permissions check on API calls from the settings page.

We confirmed this happens even if we only have WC enabled.

Expected behavior

No deprecation notices :)

Actual behavior

Deprecation notice :)

Steps to reproduce

  1. Enable WC 6.5
  2. Go to WooCommerce > Settings
  3. Check the PHP error log

The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.

WordPress Environment

n/a

Isolating the problem

woocommercebot commented 2 years ago

We are adding the status: needs reproduction label to this issue to try reproduce it on the current released version of WooCommerce.

Thank you for your patience.

swatipawarGS commented 2 years ago

Hi @jkohlbach, Thank you for taking the time to report this bug, we really appreciate your help. We are unable to reproduce the issue on our end using WooCommerce 6.4.1 version and WordPress 5.9.3 version.

Please find below screencast for reference :

https://user-images.githubusercontent.com/94531721/166645631-99bee244-5a7c-4b36-9961-9261d9a50a63.mp4

Please provide us more detailed and any additional steps required to repro this issue which may help us to evaluate it further.

jkohlbach commented 2 years ago

@swatipawarGS .... WC 6.5 RC as per the title :)

rodelgc commented 2 years ago

I was able to reproduce this issue on WC 6.5 (currently in RC 2). Using the WP Log Viewer plugin, I got the log entry just by navigating to WooCommerce > Home.

Screen Shot 2022-05-05 at 3 34 30 PM
chihsuan commented 2 years ago

I was able to reproduce this in RC 2 too. I'll create a PR to fix this.

simkoG commented 2 years ago

This notice is still there if you want to update the Woocommerce database to the newest version via WP CLI.

Steps to reproduce

  1. Update to the latest Woocommerce version via Wordpress Admin
  2. Open a WP CLI console.
  3. Run the following: wp wc update.
  4. Check the LOG file.
mikkamp commented 2 years ago

Doesn't look like the PR made it into 6.5.1, I'm still getting this warning showing up when viewing any WooCommerce page in the dashboard. The linked PR says it's set for milestone 6.6.0

superbmario commented 2 years ago

Same issue for me after updating to 6.5.1 today

csmcneill commented 2 years ago

35162418-hc

User encountered this issue with 6.4.1. Recommended updating to 6.5.1 to see if it resolves the issue.

neilgee commented 2 years ago

Still getting the notice after updating to 6.5.1

chihsuan commented 2 years ago

Doesn't look like the PR made it into 6.5.1, I'm still getting this warning showing up when viewing any WooCommerce page in the dashboard. The linked PR says it's set for milestone 6.6.0

Yes, 6.5.1 does not include this fix. It's set to be included in the 6.6.0 release.

dgswim commented 2 years ago

I have this issue as well. It has made it where my shippingeasy can not communicate with my woocommerce 6.5.1. What do I do?

I have used shippingeasy for many years until I updated to 6.5.1

brandon-9 commented 2 years ago

Same issue. API can't communicate with Woo as it returns the error.

dgswim commented 2 years ago

I am now having to create all orders manually. Then copy and paste the shipping info into woocommerce from shippingeasy. It is really causing us to struggle. I don't think I will update these plugins with the same confidence as I used to. The sad thing is we totally destroyed our website and business for several days trying to figure out what the issue is.

brandon-9 commented 2 years ago

@dgswim I rolled back to 6.4 and it works again.

I know the feeling though! So many dumb issues in Woo. I feel like there's been no meaningful progress made in years. The tax calculator still doesn't even work correctly via API. :-|

chihsuan commented 2 years ago

I have this issue as well. It has made it where my shippingeasy can not communicate with my woocommerce 6.5.1. What do I do?

Same issue. API can't communicate with Woo as it returns the error.

@dgswim @brandon-9 Sorry to hear that. These sound like other issues. 🤔

The get_options deprecated notice should only be a warning notice, not cause any API errors. You could apply this patch to test it.

However, would you be able to file a new issue about which API or plugin not working with 6.5.1? I'm happy to help fix them.

brandon-9 commented 2 years ago

I have this issue as well. It has made it where my shippingeasy can not communicate with my woocommerce 6.5.1. What do I do?

Same issue. API can't communicate with Woo as it returns the error.

@dgswim @brandon-9 Sorry to hear that. These sound like other issues. 🤔

The get_options deprecated notice should only be a warning notice, not cause any API errors. You could apply this patch to test it.

However, would you be able to file a new issue about which API or plugin not working with 6.5.1? I'm happy to help fix them.

@chihsuan

Using V3 of the Woo REST API, it would return with 500 server errors. The only logged info was this get_options warning. No errors listed. Reverted back to 6.4 and works fine again. That's all I got for now!

chihsuan commented 2 years ago

@brandon-9 Thanks for the reply! 🙏 It does sound like another issue.

The get_options function is not used in the WOO V3 REST API.

Do you remember which Woo REST V3 API you were using? It would be great if you could share the steps to reproduce the 500 error. Thanks!

brandon-9 commented 2 years ago

@chihsuan I was posting a new order through the api.

chihsuan commented 2 years ago

@brandon-9 Okay. I’ll take a look.

nplokkaar commented 2 years ago

So I guess issue is still live? I've a client who has issues with Woocommerce as well, same error logged.

Is it a possibility to rollback to 6.4 ?

What is the ETA for the fix?

chihsuan commented 2 years ago

@brandon-9 I was able to place a new order through the v3 API with woo 6.5.1. 🤔

https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order

Screen Shot 2022-05-18 at 16 55 29

chihsuan commented 2 years ago

@nplokkaar Yes, It still exists in 6.5.1. It has been fixed in the trunk branch and will be included in 6.6.0.

If you need any other help, please reach out WooCommerce Support. Thanks!

chihsuan commented 2 years ago

BTW, this deprecation notice should not cause any fatal errors. And it should only appear when you go to WooCommerce > Settings.

If you found it on other pages, it may be because other plugins make deprecated option API calls. If you encounter fatal errors, there should have another root cause. In these cases, you can do a conflict test to identify which plugin causing it.

AashikP commented 2 years ago

Thank you for clarifying @chihsuan.

We're seeing another report of this error in 5190979-zen, and clarified this should be fixed in the next update.

sonda123 commented 2 years ago

Getting the same error here. Captura de Tela 2022-05-23 às 18 48 24

erikdemarco commented 2 years ago

@sonda123 OOT, what plugin do you use to show that error log on your dashboard?

sonda123 commented 2 years ago

plugin Error Log Monitor, Version 1.7.2 | By Janis Elsts

liamf91 commented 2 years ago

I can see that update 6.6 is now in beta 1 testing - how long do updates generally take to be released to "live"?

chihsuan commented 2 years ago

@liamf91 We aim to release a new version of WooCommerce every second Tuesday of each month. So 6.6 release date will be 6/14.

You can learn more about this at these links. https://developer.woocommerce.com/2021/04/27/improving-releases-with-automation/ https://developer.woocommerce.com/2020/07/22/woocommerce-core-release-calendar/

EjayhanFernandes commented 2 years ago

We're seeing another report of this error in 35634095-hc, and clarified this should be fixed in the next update.

EjayhanFernandes commented 2 years ago

We're seeing another report of this error in 5282020-zen, and clarified this should be fixed in the next update

MysticMedusa commented 2 years ago

Hello I am using the latest Wc and this option is still showing up in the error log - is there an update on when it will be resolved please?

chihsuan commented 2 years ago

Hi @MysticMedusa Do you mean you still encountering this with the same steps?

Enable WC 6.5 Go to WooCommerce > Settings Check the PHP error log

Or could you please share the steps to reproduce the error? Thanks!

chihsuan commented 2 years ago

it might be worth mentioning that we have deprecated the update/get of options that are not default from WC.

So it's a known issue if other plugins are using this API.

MysticMedusa commented 2 years ago

A

Am now on 6.7 which I updated hoping would fix the issue. It shows up on php error log and now the Add to Cart button does not work. Because it is literaly just non responsive, it's difficult to track what is going on. I am going to try Woo Support but they're usually unhelpful.

chihsuan commented 2 years ago

Am now on 6.7 which I updated hoping would fix the issue. It shows up on php error log and now the Add to Cart button does not work. Because it is literaly just non responsive, it's difficult to track what is going on. I am going to try Woo Support but they're usually unhelpful.

Hi @MysticMedusa Sorry to hear about that. 😞 The original issue has been fixed in 6.7 and this option error notice won't break anything. There must have another root cause.

I just tried it and was able to click on the "Add to Cart" button with the latest WC so I guess it might be due to a plugin you used. Unfortunately, I cannot help without more details. At this moment, Woo Support is indeed a possible way to help with. 🤞

I'd suggest that you can also share your "Console and Network Logs" with Woo Support. I could help if it's a front-end error. Thank you!

MysticMedusa commented 2 years ago

Hi Thanks for this - the add to cart issue was actually Akismet! I am so sorry - however, why do you think this error is still showing up in the logs?


[4]

On 2022-08-03 09:36, Chi-Hsuan Huang wrote:

Am now on 6.7 which I updated hoping would fix the issue. It shows up on php error log and now the Add to Cart button does not work. Because it is literaly just non responsive, it's difficult to track what is going on. I am going to try Woo Support but they're usually unhelpful.

Hi @MysticMedusa [1] Sorry to hear about that. 😞 The original issue has been fixed in 6.7 and this option error notice won't break anything. There must have another root cause.

I just tried it and was able to click on the "Add to Cart" button with the latest WC so I guess it might be due to a plugin you used. Unfortunately, I cannot help without more details. At this moment, Woo Support is indeed a possible way to help with.

I'd suggest that you can also share your "Console and Network Logs" with Woo Support. I could help if it's a front-end error. Thank you!

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you were mentioned.Message ID: @.***>

Links:

[1] https://github.com/MysticMedusa [2] https://github.com/woocommerce/woocommerce/issues/32863#issuecomment-1203960628 [3] https://github.com/notifications/unsubscribe-auth/APXIOQ3BMZEQH56LEZJMN4DVXJYU5ANCNFSM5VAJYHPQ [4] https://mysticmedusa.com/

chihsuan commented 2 years ago

Hi Thanks for this - the add to cart issue was actually Akismet! I am so sorry

@MysticMedusa No worries. Glad you fix it!

  • however, why do you think this error is still showing up in the logs?

I suspect there is a plugin that still uses the deprecated option API. Have you tried to disable all other plugins except WooCommerce and see if the error still shows up?

You could follow the How to do a conflict test to determine which plugin causes this. However, don't worry if this error log appears. Again, it's just a warning, everything should still work.

Thank you!

nekranox commented 1 year ago

Hi there,

We have this same issue on a blank WordPress with only WooCommerce installed and Storefront theme. When pushing product data via REST API we encounter PHP error:

[12-Jan-2023 13:19:08 UTC] The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.

No other plugins are installed, completely fresh install with no existing data.

Censored health/site info report attached. site-info.txt

It must be an issue relating to the core WooCommerce plugin, please advise.

chihsuan commented 1 year ago

@nekranox Could you create a new issue for it as this has been fixed for WC 6.5RC? Thanks!

https://github.com/woocommerce/woocommerce/issues/new?assignees=&labels=&template=1-bug-report.yml

starciucradu commented 1 year ago

I still have this issue occurring with latest version of woocommerce and latest version of wordpress!

MysticMedusa commented 1 year ago

Same. Would love to find a fix as it clogs up error log.


On 2023-01-28 16:03, starciucradu wrote:

I still have this issue occurring with latest version of woocommerce and latest version of wordpress!

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you were mentioned.Message ID: @.***>

Links:

[1] https://github.com/woocommerce/woocommerce/issues/32863#issuecomment-1407487569 [2] https://github.com/notifications/unsubscribe-auth/APXIOQ3KVCNUOE2BPJUNGHTWUWCTVANCNFSM5VAJYHPQ

KoolPal commented 1 year ago

@chihsuan Notice still seen in WooCommerce version: 7.7.0!! Please fix Thanks

chihsuan commented 1 year ago

@KoolPal Thanks for the ping! I've opened a PR to fix it.

lgdelai commented 1 year ago

The error still happens here too, on WC v7.7.0. [15-May-2023 20:40:44 UTC] The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.

TitoWhisky commented 1 year ago

The error still happens here too, on WC v7.7.2. [09-Jun-2023 19:40:49 UTC] The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.

Martje65 commented 1 year ago

THe erro still happens to my on WC 7.7.2 and WP 6.6.2 and PHP 7.4

Backend log: The Automattic\WooCommerce\Admin\API\Options::get_options function is deprecated since version 3.1.\n, referer: https://www.test.nl/wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period

edwinho89 commented 1 year ago

One user reported this on 6469248-zd-woothemes

chihsuan commented 1 year ago

The https://github.com/woocommerce/woocommerce/pull/38388 fix will be included in 7.9 WC.