diff --git a/actions/WooCommerceBeforeAddToCartButtonAction.php b/actions/WooCommerceBeforeAddToCartButtonAction.php index 00c1090..f802e66 100644 --- a/actions/WooCommerceBeforeAddToCartButtonAction.php +++ b/actions/WooCommerceBeforeAddToCartButtonAction.php @@ -32,14 +32,22 @@ class WooCommerceBeforeAddToCartButtonAction extends RadAction foreach ($attributes as $attribute) { $name = $attribute->get_name(); + if (!is_array($attribute->get_options())) { + continue; + } + + if (count($attribute->get_options()) < 1) { + continue; + } + if ($name === "Rental Rate (Daily)") { - $rentalRates["daily"] = $attribute->get_options(); + $rentalRates["daily"] = $attribute->get_options()[0]; } if ($name === "Rental Rate (Weekly)") { - $rentalRates["weekly"] = $attribute->get_options(); + $rentalRates["weekly"] = $attribute->get_options()[0]; } if ($name === "Rental Rate (Monthly)") { - $rentalRates["monthly"] = $attribute->get_options(); + $rentalRates["monthly"] = $attribute->get_options()[0]; } } print_r($rentalRates);