WP Crowdfunding and Subscriptions error
-
First of all thanks for a great plugin.
First some background – we’re having a shop that also uses WP Crowdfunding. Everything was working great until we decided to add Subscriptions ( https://woocommerce.com/products/woocommerce-subscriptions/ ). The first order went ok, but reneval didn’t.
After some debugging we found the problem was:
<b>Fatal error</b>: Uncaught Error: Call to a member function get() on null in web/app/plugins/wp-crowdfunding/includes/woocommerce/class-wpneo-crowdfunding.php:722To fix you need to change the wp-crowdfunding/includes/woocommerce/class-wpneo-crowdfunding.php
from:
$wpneo_rewards_data = WC()->session->get('wpneo_rewards_data'); if ( ! empty($wpneo_rewards_data)){ $campaign_rewards = get_post_meta($wpneo_rewards_data['product_id'], 'wpneo_reward', true); $campaign_rewards = stripslashes($campaign_rewards); $campaign_rewards_a = json_decode($campaign_rewards, true); $reward = $campaign_rewards_a[$wpneo_rewards_data['rewards_index']]; update_post_meta($order_id, 'wpneo_selected_reward', $reward); update_post_meta($order_id, '_cf_product_author_id', $wpneo_rewards_data['_cf_product_author_id'] ); WC()->session->__unset('wpneo_rewards_data'); }to
if( WC()->session != null ) { $wpneo_rewards_data = WC()->session->get('wpneo_rewards_data'); if ( ! empty($wpneo_rewards_data)){ $campaign_rewards = get_post_meta($wpneo_rewards_data['product_id'], 'wpneo_reward', true); $campaign_rewards = stripslashes($campaign_rewards); $campaign_rewards_a = json_decode($campaign_rewards, true); $reward = $campaign_rewards_a[$wpneo_rewards_data['rewards_index']]; update_post_meta($order_id, 'wpneo_selected_reward', $reward); update_post_meta($order_id, '_cf_product_author_id', $wpneo_rewards_data['_cf_product_author_id'] ); WC()->session->__unset('wpneo_rewards_data'); } }This fixes the problem.
The topic ‘WP Crowdfunding and Subscriptions error’ is closed to new replies.