After upgrade to 3.X I get zero price
-
After upgrading from 2.4.X to newest version of WooCommerce, I get zero price on variation products.
public function __construct( $product ) { $this->product_type = 'audio_conference'; parent::__construct( $product ); $this->meta = $this->set_meta(); $current_pricing = $this->get_pricing(); if ( ! empty( $current_pricing['recording'] ) ) { $this->price = ( ! empty( $current_pricing['recording']['sale'] ) ? $current_pricing['recording']['sale'] : $current_pricing['recording']['regular'] ); } elseif ( ! empty( $current_pricing['event'] ) ) { $this->price = ( ! empty( $current_pricing['event']['sale'] ) ? $current_pricing['event']['sale'] : $current_pricing['event']['regular'] ); } elseif ( ! empty( $current_pricing['ondemand'] ) ) { $this->price = ( ! empty( $current_pricing['ondemand']['sale'] ) ? $current_pricing['ondemand']['sale'] : $current_pricing['ondemand']['regular'] ); } else { $this->price = 0; } } public function get_pricing() { global $c4cm; $pricing = array(); if (is_array($c4cm['audio-conference']['selections']) || is_object($c4cm['audio-conference']['selections'])) { foreach ( $c4cm['audio-conference']['selections'] as $type => $title ) { // Check if last sale date is set, if not set to event date if ( ( $type == 'event' || $type == 'bundle' ) && $this->event_has_past() ) { $pricing[$type] = false; continue; } $key_rp = $type . '_price'; $key_ep = $type . '_early_bird_price'; if ( $type == 'recording' && ! $this->meta->{$key_rp} ) { $pricing[$type] = false; continue; } if ( $type == 'ondemand' && ! $this->meta->{$key_rp} ) { $pricing[$type] = false; continue; }2 $pricing[$type]['regular'] = $this->meta->{$key_rp}; // check for early bird sale if ( $this->early_bird_sale_is_active() && $this->meta->{$key_ep} ) { $pricing[$type]['sale'] = $this->meta->$key_ep; } else { $pricing[$type]['sale'] = false; } } } return $pricing; }
I have managed to correct all the other issues, but this is the one left and I can’t figure out where the issue is. WooCommerce indicates in their upgrade guidelines that things have changed, but I can’t get my head around it.
So all help would be greatly appreciated!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘After upgrade to 3.X I get zero price’ is closed to new replies.