HasteDesign / Registrations-for-WooCommerce

Add a registration product type to your WooCommerce installation.
GNU General Public License v2.0
38 stars 16 forks source link

Registrations products always out of stock #42

Open rbsmidt opened 5 years ago

rbsmidt commented 5 years ago

Describe the bug All products show as out-of-stock. Similar to this issue: https://github.com/HasteDesign/Registrations-for-WooCommerce/issues/28 I'm running version 2.0.5 of the plugin and newest version of wp and woo (wp 5.2.1, woo 3.6.2) I've tracked the issue to $product->get_available_variations() returning empty. Digging deeper into woo core it seems to be return statement of get_available_variation from class-wc-product-variable.php that returns null. I've tried setting products to virtual, setting stock value at variation level, setting stock at general product level. But products keep showing as out of stock. If i fetch variation data from other woocommerce functions (product->get_children() then fetch all children with wc_get_product($child_id)) i get the data.

To Reproduce Steps to reproduce the behavior:

  1. Add registration product with dates and variations
  2. Navigate to single view of product
  3. "product out of stock" message is shown

Expected behavior Expected product single view to show add to cart button.

Isolating the problem (mark completed items with an [x]): I have tested with only woocommerce and registrations for woocommerce as active plugins.

WordPress Environment WP 5.2 WooCommerce 3.6.2 Registrations for WooCommerce 2.0.5

rbsmidt commented 5 years ago

I'm definitely up for helping debugging this case some more and perhaps help out with at solution if needed? I read the bug i referenced here and it was fixed and closed by release 2.0.4. @allysonsouza can you give a quick brush up of what changes in woo core caused the bug earlier, and what did you fix to patch it?

allysonsouza commented 5 years ago

Hi @rbsmidt, you probably took a look at this issue: https://github.com/HasteDesign/Registrations-for-WooCommerce/issues/28#issuecomment-393731827, right?

I cannot remember exactly what was causing that, but I remeber it was because of a change in one of the WC_Product_Variable methods that WC_Registrations overrides, so I would take a look if WooCommerce updated something in those methods.

rbsmidt commented 5 years ago

HI @allysonsouza - yeah that's the issue i was referring to. Thanks for your info, i'll take a look at it shortly and post any progress in this thread.