woocommerce/woocommerce

`WC_Abstract_Order` does not implement `get_customer_id()`

オープン

#30,922 opened on 2021/10/11

 (9 件のコメント) (1 件のリアクション) (0 人の担当者)PHP (10,695 件のフォーク)batch import
BugData Structure/CRUD/Backend ProcessingFluxGood First Issueneeds: engineeringplugin: woocommerce

Repository metrics

Stars
 (10,294 個のスター)
PR merge metrics
 (平均マージ 9d 12h) (30d で 423 merged PRs)

説明

Prerequisites (mark completed items with an [x]):

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug The apply_coupon() method in WC_Abstract_Order calls get_customer_id(), but a custom order might not implement this method (and it's not defined in the base class).

Expected behavior get_customer_id()/set_customer_id() should be implemented in the abstract class.

Actual behavior Calling get_customer_id() on a WC_Order_Refund causes an Error.

Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:

  1. $refund = wc_create_refund(...);
  2. $refund->get_customer_id()

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment N/A

コントリビューターガイド