woocommerce/woocommerce

`WC_Abstract_Order` does not implement `get_customer_id()`

Offen

#30.922 geöffnet am 11.10.2021

 (9 Kommentare) (1 Reaktion) (0 zugewiesene Personen)PHP (10.695 Forks)batch import
BugData Structure/CRUD/Backend ProcessingFluxGood First Issueneeds: engineeringplugin: woocommerce

Repository-Metriken

Stars
 (10.294 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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

Contributor Guide