Commit 1469941b authored by Varun Sridharan's avatar Varun Sridharan

Merge pull request #6 from bgallagh3r/master

Fix issue where donation_exists() throws an error due to NULL value
parents ceedeef6 382c8613
...@@ -216,7 +216,7 @@ class wc_quick_donation{ ...@@ -216,7 +216,7 @@ class wc_quick_donation{
*/ */
public function donation_exsits(){ public function donation_exsits(){
global $woocommerce; global $woocommerce;
if( sizeof($woocommerce->cart->get_cart()) > 0){ if(is_object($woocommerce->cart) && sizeof($woocommerce->cart->get_cart()) > 0){
foreach($woocommerce->cart->get_cart() as $cart_item_key => $values){ foreach($woocommerce->cart->get_cart() as $cart_item_key => $values){
$_product = $values['data']; $_product = $values['data'];
if($_product->id == $this->donation_id){ if($_product->id == $this->donation_id){
...@@ -562,4 +562,4 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g ...@@ -562,4 +562,4 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
function wc_quick_donation_notice() { function wc_quick_donation_notice() {
echo '<div class="error"><p><strong> <i> Woocommerce Quick Donation </i> </strong> Requires <a href="'.admin_url( 'plugin-install.php?tab=plugin-information&plugin=woocommerce').'"> <strong> <u>Woocommerce</u></strong> </a> To Be Installed And Activated </p></div>'; echo '<div class="error"><p><strong> <i> Woocommerce Quick Donation </i> </strong> Requires <a href="'.admin_url( 'plugin-install.php?tab=plugin-information&plugin=woocommerce').'"> <strong> <u>Woocommerce</u></strong> </a> To Be Installed And Activated </p></div>';
} }
?> ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment